{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import dask.distributed\n",
    "import dask.dataframe as dd\n",
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "client = dask.distributed.Client('localhost:8786')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Client: scheduler='tcp://localhost:8786' processes=4 cores=4>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "client.restart()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df = dd.read_parquet('/bigdata/citibike.parquet')\n",
    "# df = client.persist(df.repartition(npartitions=20))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>trip_duration</th>\n",
       "      <th>start_time</th>\n",
       "      <th>stop_time</th>\n",
       "      <th>start_station_id</th>\n",
       "      <th>start_station_name</th>\n",
       "      <th>start_station_latitude</th>\n",
       "      <th>start_station_longitude</th>\n",
       "      <th>end_station_id</th>\n",
       "      <th>end_station_name</th>\n",
       "      <th>end_station_latitude</th>\n",
       "      <th>end_station_longitude</th>\n",
       "      <th>bike_id</th>\n",
       "      <th>user_type</th>\n",
       "      <th>birth_year</th>\n",
       "      <th>gender</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>634</td>\n",
       "      <td>2013-07-01 00:00:00</td>\n",
       "      <td>2013-07-01 00:10:34</td>\n",
       "      <td>164</td>\n",
       "      <td>E 47 St &amp; 2 Ave</td>\n",
       "      <td>40.753231</td>\n",
       "      <td>-73.970322</td>\n",
       "      <td>504</td>\n",
       "      <td>1 Ave &amp; E 15 St</td>\n",
       "      <td>40.732220</td>\n",
       "      <td>-73.981659</td>\n",
       "      <td>16950</td>\n",
       "      <td>Customer</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1547</td>\n",
       "      <td>2013-07-01 00:00:02</td>\n",
       "      <td>2013-07-01 00:25:49</td>\n",
       "      <td>388</td>\n",
       "      <td>W 26 St &amp; 10 Ave</td>\n",
       "      <td>40.749718</td>\n",
       "      <td>-74.002953</td>\n",
       "      <td>459</td>\n",
       "      <td>W 20 St &amp; 11 Ave</td>\n",
       "      <td>40.746746</td>\n",
       "      <td>-74.007759</td>\n",
       "      <td>19816</td>\n",
       "      <td>Customer</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>178</td>\n",
       "      <td>2013-07-01 00:01:04</td>\n",
       "      <td>2013-07-01 00:04:02</td>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "      <td>237</td>\n",
       "      <td>E 11 St &amp; 2 Ave</td>\n",
       "      <td>40.730473</td>\n",
       "      <td>-73.986725</td>\n",
       "      <td>14548</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1980.0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1580</td>\n",
       "      <td>2013-07-01 00:01:06</td>\n",
       "      <td>2013-07-01 00:27:26</td>\n",
       "      <td>531</td>\n",
       "      <td>Forsyth St &amp; Broome St</td>\n",
       "      <td>40.718941</td>\n",
       "      <td>-73.992661</td>\n",
       "      <td>499</td>\n",
       "      <td>Broadway &amp; W 60 St</td>\n",
       "      <td>40.769154</td>\n",
       "      <td>-73.981918</td>\n",
       "      <td>16063</td>\n",
       "      <td>Customer</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>757</td>\n",
       "      <td>2013-07-01 00:01:10</td>\n",
       "      <td>2013-07-01 00:13:47</td>\n",
       "      <td>382</td>\n",
       "      <td>University Pl &amp; E 14 St</td>\n",
       "      <td>40.734928</td>\n",
       "      <td>-73.992004</td>\n",
       "      <td>410</td>\n",
       "      <td>Suffolk St &amp; Stanton St</td>\n",
       "      <td>40.720665</td>\n",
       "      <td>-73.985176</td>\n",
       "      <td>19213</td>\n",
       "      <td>Subscriber</td>\n",
       "      <td>1986.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   trip_duration           start_time            stop_time  start_station_id  \\\n",
       "0            634  2013-07-01 00:00:00  2013-07-01 00:10:34               164   \n",
       "1           1547  2013-07-01 00:00:02  2013-07-01 00:25:49               388   \n",
       "2            178  2013-07-01 00:01:04  2013-07-01 00:04:02               293   \n",
       "3           1580  2013-07-01 00:01:06  2013-07-01 00:27:26               531   \n",
       "4            757  2013-07-01 00:01:10  2013-07-01 00:13:47               382   \n",
       "\n",
       "        start_station_name  start_station_latitude  start_station_longitude  \\\n",
       "0          E 47 St & 2 Ave               40.753231               -73.970322   \n",
       "1         W 26 St & 10 Ave               40.749718               -74.002953   \n",
       "2    Lafayette St & E 8 St               40.730286               -73.990768   \n",
       "3   Forsyth St & Broome St               40.718941               -73.992661   \n",
       "4  University Pl & E 14 St               40.734928               -73.992004   \n",
       "\n",
       "   end_station_id         end_station_name  end_station_latitude  \\\n",
       "0             504          1 Ave & E 15 St             40.732220   \n",
       "1             459         W 20 St & 11 Ave             40.746746   \n",
       "2             237          E 11 St & 2 Ave             40.730473   \n",
       "3             499       Broadway & W 60 St             40.769154   \n",
       "4             410  Suffolk St & Stanton St             40.720665   \n",
       "\n",
       "   end_station_longitude  bike_id   user_type  birth_year  gender  \n",
       "0             -73.981659    16950    Customer         NaN       0  \n",
       "1             -74.007759    19816    Customer         NaN       0  \n",
       "2             -73.986725    14548  Subscriber      1980.0       2  \n",
       "3             -73.981918    16063    Customer         NaN       0  \n",
       "4             -73.985176    19213  Subscriber      1986.0       1  "
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "all_ids_in_dataset = df.start_station_id.unique().compute().values.tolist() + df.end_station_id.unique().compute().values.tolist()\n",
    "all_ids_in_dataset.sort()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import urllib, json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>altitude</th>\n",
       "      <th>availableBikes</th>\n",
       "      <th>availableDocks</th>\n",
       "      <th>city</th>\n",
       "      <th>id</th>\n",
       "      <th>landMark</th>\n",
       "      <th>lastCommunicationTime</th>\n",
       "      <th>latitude</th>\n",
       "      <th>location</th>\n",
       "      <th>longitude</th>\n",
       "      <th>postalCode</th>\n",
       "      <th>stAddress1</th>\n",
       "      <th>stAddress2</th>\n",
       "      <th>stationName</th>\n",
       "      <th>statusKey</th>\n",
       "      <th>statusValue</th>\n",
       "      <th>testStation</th>\n",
       "      <th>totalDocks</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td></td>\n",
       "      <td>1</td>\n",
       "      <td>37</td>\n",
       "      <td></td>\n",
       "      <td>72</td>\n",
       "      <td></td>\n",
       "      <td>2017-04-19 12:56:59 PM</td>\n",
       "      <td>40.767272</td>\n",
       "      <td></td>\n",
       "      <td>-73.993929</td>\n",
       "      <td></td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td></td>\n",
       "      <td>W 52 St &amp; 11 Ave</td>\n",
       "      <td>1</td>\n",
       "      <td>In Service</td>\n",
       "      <td>False</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td></td>\n",
       "      <td>27</td>\n",
       "      <td>6</td>\n",
       "      <td></td>\n",
       "      <td>79</td>\n",
       "      <td></td>\n",
       "      <td>2017-04-19 12:56:18 PM</td>\n",
       "      <td>40.719116</td>\n",
       "      <td></td>\n",
       "      <td>-74.006667</td>\n",
       "      <td></td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td></td>\n",
       "      <td>Franklin St &amp; W Broadway</td>\n",
       "      <td>1</td>\n",
       "      <td>In Service</td>\n",
       "      <td>False</td>\n",
       "      <td>33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td></td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>82</td>\n",
       "      <td></td>\n",
       "      <td>2017-04-13 12:05:52 PM</td>\n",
       "      <td>40.711174</td>\n",
       "      <td></td>\n",
       "      <td>-74.000165</td>\n",
       "      <td></td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td></td>\n",
       "      <td>St James Pl &amp; Pearl St</td>\n",
       "      <td>3</td>\n",
       "      <td>Not In Service</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td></td>\n",
       "      <td>33</td>\n",
       "      <td>26</td>\n",
       "      <td></td>\n",
       "      <td>83</td>\n",
       "      <td></td>\n",
       "      <td>2017-04-19 12:58:16 PM</td>\n",
       "      <td>40.683826</td>\n",
       "      <td></td>\n",
       "      <td>-73.976323</td>\n",
       "      <td></td>\n",
       "      <td>Atlantic Ave &amp; Fort Greene Pl</td>\n",
       "      <td></td>\n",
       "      <td>Atlantic Ave &amp; Fort Greene Pl</td>\n",
       "      <td>1</td>\n",
       "      <td>In Service</td>\n",
       "      <td>False</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td></td>\n",
       "      <td>12</td>\n",
       "      <td>26</td>\n",
       "      <td></td>\n",
       "      <td>116</td>\n",
       "      <td></td>\n",
       "      <td>2017-04-19 12:58:08 PM</td>\n",
       "      <td>40.741776</td>\n",
       "      <td></td>\n",
       "      <td>-74.001497</td>\n",
       "      <td></td>\n",
       "      <td>W 17 St &amp; 8 Ave</td>\n",
       "      <td></td>\n",
       "      <td>W 17 St &amp; 8 Ave</td>\n",
       "      <td>1</td>\n",
       "      <td>In Service</td>\n",
       "      <td>False</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  altitude  availableBikes  availableDocks city   id landMark  \\\n",
       "0                        1              37        72            \n",
       "1                       27               6        79            \n",
       "2                        0               0        82            \n",
       "3                       33              26        83            \n",
       "4                       12              26       116            \n",
       "\n",
       "    lastCommunicationTime   latitude location  longitude postalCode  \\\n",
       "0  2017-04-19 12:56:59 PM  40.767272          -73.993929              \n",
       "1  2017-04-19 12:56:18 PM  40.719116          -74.006667              \n",
       "2  2017-04-13 12:05:52 PM  40.711174          -74.000165              \n",
       "3  2017-04-19 12:58:16 PM  40.683826          -73.976323              \n",
       "4  2017-04-19 12:58:08 PM  40.741776          -74.001497              \n",
       "\n",
       "                      stAddress1 stAddress2                    stationName  \\\n",
       "0               W 52 St & 11 Ave                          W 52 St & 11 Ave   \n",
       "1       Franklin St & W Broadway                  Franklin St & W Broadway   \n",
       "2         St James Pl & Pearl St                    St James Pl & Pearl St   \n",
       "3  Atlantic Ave & Fort Greene Pl             Atlantic Ave & Fort Greene Pl   \n",
       "4                W 17 St & 8 Ave                           W 17 St & 8 Ave   \n",
       "\n",
       "   statusKey     statusValue testStation  totalDocks  \n",
       "0          1      In Service       False          39  \n",
       "1          1      In Service       False          33  \n",
       "2          3  Not In Service       False           0  \n",
       "3          1      In Service       False          62  \n",
       "4          1      In Service       False          39  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zz = pd.DataFrame(json.loads(\n",
    "        (urllib.request.urlopen('https://feeds.citibikenyc.com/stations/stations.json').read()).decode('utf-8')\n",
    "    )['stationBeanList'])\n",
    "zz.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(36902025,)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.start_station_id.compute().shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df_s = df[['start_station_id', 'start_station_name', 'start_station_latitude', 'start_station_longitude']]\n",
    "df_e = df[['end_station_id', 'end_station_name', 'end_station_latitude', 'end_station_longitude']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_s = df_s[(df_s.start_station_latitude > 40.) & (df_s.start_station_latitude < 41.)]\n",
    "df_s = df_s[(df_s.start_station_longitude + 74.0 > -0.25) & (df_s.start_station_longitude + 74.0 < 0.25)]\n",
    "\n",
    "df_e = df_e[(df_e.end_station_latitude > 40.) & (df_e.end_station_latitude < 41.)]\n",
    "df_e = df_e[(df_e.end_station_longitude + 74.0 > -0.25) & (df_e.end_station_longitude + 74.0 < 0.25)]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>start_station_id</th>\n",
       "      <th>start_station_name</th>\n",
       "      <th>start_station_latitude</th>\n",
       "      <th>start_station_longitude</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>164</td>\n",
       "      <td>E 47 St &amp; 2 Ave</td>\n",
       "      <td>40.753231</td>\n",
       "      <td>-73.970322</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>388</td>\n",
       "      <td>W 26 St &amp; 10 Ave</td>\n",
       "      <td>40.749718</td>\n",
       "      <td>-74.002953</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>293</td>\n",
       "      <td>Lafayette St &amp; E 8 St</td>\n",
       "      <td>40.730286</td>\n",
       "      <td>-73.990768</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>531</td>\n",
       "      <td>Forsyth St &amp; Broome St</td>\n",
       "      <td>40.718941</td>\n",
       "      <td>-73.992661</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>382</td>\n",
       "      <td>University Pl &amp; E 14 St</td>\n",
       "      <td>40.734928</td>\n",
       "      <td>-73.992004</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   start_station_id       start_station_name  start_station_latitude  \\\n",
       "0               164          E 47 St & 2 Ave               40.753231   \n",
       "1               388         W 26 St & 10 Ave               40.749718   \n",
       "2               293    Lafayette St & E 8 St               40.730286   \n",
       "3               531   Forsyth St & Broome St               40.718941   \n",
       "4               382  University Pl & E 14 St               40.734928   \n",
       "\n",
       "   start_station_longitude  \n",
       "0               -73.970322  \n",
       "1               -74.002953  \n",
       "2               -73.990768  \n",
       "3               -73.992661  \n",
       "4               -73.992004  "
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_s.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "a1 = df_s.groupby(['start_station_id', 'start_station_name']).mean().compute()\n",
    "a2 = df_e.groupby(['end_station_id', 'end_station_name']).mean().compute()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "b1 = a1.copy()\n",
    "b2 = a2.copy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "b1.index = b1.index.rename(['id', 'name'])\n",
    "b1.columns = ['lat', 'lon']\n",
    "b2.index = b2.index.rename(['id', 'name'])\n",
    "b2.columns = ['lat', 'lon']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [],
   "source": [
    "c = b1.append(b2).drop_duplicates().reset_index().sort_values('id').reset_index(drop=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>start_station_id</th>\n",
       "      <th>start_station_name</th>\n",
       "      <th>end_station_id</th>\n",
       "      <th>end_station_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>266052</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>268611</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>268802</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>269195</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>341927</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>343318</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>347861</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>365081</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>373718</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>374793</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>375450</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6667</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20079</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21458</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23007</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23382</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24112</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25791</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        start_station_id start_station_name  end_station_id end_station_name\n",
       "266052              3239           Bressler            3239         Bressler\n",
       "268611              3239           Bressler            3239         Bressler\n",
       "268802              3239           Bressler            3239         Bressler\n",
       "269195              3239           Bressler            3239         Bressler\n",
       "341927              3239           Bressler            3239         Bressler\n",
       "343318              3239           Bressler            3239         Bressler\n",
       "347861              3239           Bressler            3239         Bressler\n",
       "365081              3239           Bressler            3239         Bressler\n",
       "373718              3239           Bressler            3239         Bressler\n",
       "374793              3239           Bressler            3239         Bressler\n",
       "375450              3239           Bressler            3239         Bressler\n",
       "6667                3239           Bressler            3239         Bressler\n",
       "20079               3239           Bressler            3239         Bressler\n",
       "21458               3239           Bressler            3239         Bressler\n",
       "23007               3239           Bressler            3239         Bressler\n",
       "23382               3239           Bressler            3239         Bressler\n",
       "24112               3239           Bressler            3239         Bressler\n",
       "25791               3239           Bressler            3239         Bressler"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mm = (df[['start_station_id', 'start_station_name', 'end_station_id', 'end_station_name']])[(df.start_station_id==3239) | (df.end_station_id == 3239)].compute()\n",
    "mm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1074</th>\n",
       "      <td>3239</td>\n",
       "      <td>Bressler</td>\n",
       "      <td>40.646539</td>\n",
       "      <td>-74.016588</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1083</th>\n",
       "      <td>3245</td>\n",
       "      <td>Kiosk in a box Motivate</td>\n",
       "      <td>40.646677</td>\n",
       "      <td>-74.016298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>734</th>\n",
       "      <td>3040</td>\n",
       "      <td>SSP Tech Workshop</td>\n",
       "      <td>40.646678</td>\n",
       "      <td>-74.016262</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>733</th>\n",
       "      <td>3040</td>\n",
       "      <td>SSP Tech Workshop</td>\n",
       "      <td>40.646679</td>\n",
       "      <td>-74.016269</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>116</th>\n",
       "      <td>255</td>\n",
       "      <td>NYCBS Depot - SSP</td>\n",
       "      <td>40.646765</td>\n",
       "      <td>-74.016513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>117</th>\n",
       "      <td>255</td>\n",
       "      <td>NYCBS Depot - SSP</td>\n",
       "      <td>40.646766</td>\n",
       "      <td>-74.016510</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>731</th>\n",
       "      <td>3036</td>\n",
       "      <td>8D OPS 01</td>\n",
       "      <td>40.651489</td>\n",
       "      <td>-74.026636</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1384</th>\n",
       "      <td>3423</td>\n",
       "      <td>West Drive &amp; Prospect Park West</td>\n",
       "      <td>40.661064</td>\n",
       "      <td>-73.979458</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1385</th>\n",
       "      <td>3423</td>\n",
       "      <td>West Drive &amp; Prospect Park West</td>\n",
       "      <td>40.661066</td>\n",
       "      <td>-73.979451</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1400</th>\n",
       "      <td>3432</td>\n",
       "      <td>Bike in Movie Night | Prospect Park Bandshell</td>\n",
       "      <td>40.662987</td>\n",
       "      <td>-73.976919</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1401</th>\n",
       "      <td>3432</td>\n",
       "      <td>Bike in Movie Night | Prospect Park Bandshell</td>\n",
       "      <td>40.662988</td>\n",
       "      <td>-73.976922</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1172</th>\n",
       "      <td>3310</td>\n",
       "      <td>14 St &amp; 7 Ave</td>\n",
       "      <td>40.663779</td>\n",
       "      <td>-73.983970</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1173</th>\n",
       "      <td>3310</td>\n",
       "      <td>14 St &amp; 7 Ave</td>\n",
       "      <td>40.663781</td>\n",
       "      <td>-73.983969</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1153</th>\n",
       "      <td>3300</td>\n",
       "      <td>Prospect Park West &amp; 8 St</td>\n",
       "      <td>40.665146</td>\n",
       "      <td>-73.976375</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1152</th>\n",
       "      <td>3300</td>\n",
       "      <td>Prospect Park West &amp; 8 St</td>\n",
       "      <td>40.665147</td>\n",
       "      <td>-73.976377</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1165</th>\n",
       "      <td>3306</td>\n",
       "      <td>10 St &amp; 7 Ave</td>\n",
       "      <td>40.666206</td>\n",
       "      <td>-73.982001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1164</th>\n",
       "      <td>3306</td>\n",
       "      <td>10 St &amp; 7 Ave</td>\n",
       "      <td>40.666208</td>\n",
       "      <td>-73.982001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1188</th>\n",
       "      <td>3319</td>\n",
       "      <td>14 St &amp; 5 Ave</td>\n",
       "      <td>40.666285</td>\n",
       "      <td>-73.988950</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1189</th>\n",
       "      <td>3319</td>\n",
       "      <td>14 St &amp; 5 Ave</td>\n",
       "      <td>40.666287</td>\n",
       "      <td>-73.988959</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1178</th>\n",
       "      <td>3313</td>\n",
       "      <td>6 Ave &amp; 12 St</td>\n",
       "      <td>40.666319</td>\n",
       "      <td>-73.985456</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1179</th>\n",
       "      <td>3313</td>\n",
       "      <td>6 Ave &amp; 12 St</td>\n",
       "      <td>40.666319</td>\n",
       "      <td>-73.985458</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1160</th>\n",
       "      <td>3304</td>\n",
       "      <td>6 Ave &amp; 9 St</td>\n",
       "      <td>40.668124</td>\n",
       "      <td>-73.983782</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1161</th>\n",
       "      <td>3304</td>\n",
       "      <td>6 Ave &amp; 9 St</td>\n",
       "      <td>40.668125</td>\n",
       "      <td>-73.983779</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1252</th>\n",
       "      <td>3354</td>\n",
       "      <td>3 St &amp; Prospect Park West</td>\n",
       "      <td>40.668132</td>\n",
       "      <td>-73.973639</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1253</th>\n",
       "      <td>3354</td>\n",
       "      <td>3 St &amp; Prospect Park West</td>\n",
       "      <td>40.668133</td>\n",
       "      <td>-73.973642</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1198</th>\n",
       "      <td>3324</td>\n",
       "      <td>3 Ave &amp; 14 St</td>\n",
       "      <td>40.668544</td>\n",
       "      <td>-73.993327</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1199</th>\n",
       "      <td>3324</td>\n",
       "      <td>3 Ave &amp; 14 St</td>\n",
       "      <td>40.668544</td>\n",
       "      <td>-73.993333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1194</th>\n",
       "      <td>3322</td>\n",
       "      <td>12 St &amp; 4 Ave</td>\n",
       "      <td>40.668601</td>\n",
       "      <td>-73.990444</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1195</th>\n",
       "      <td>3322</td>\n",
       "      <td>12 St &amp; 4 Ave</td>\n",
       "      <td>40.668602</td>\n",
       "      <td>-73.990439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1186</th>\n",
       "      <td>3317</td>\n",
       "      <td>10 St &amp; 5 Ave</td>\n",
       "      <td>40.668628</td>\n",
       "      <td>-73.987002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1181</th>\n",
       "      <td>3314</td>\n",
       "      <td>W 95 St &amp; Broadway</td>\n",
       "      <td>40.793769</td>\n",
       "      <td>-73.971884</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1180</th>\n",
       "      <td>3314</td>\n",
       "      <td>W 95 St &amp; Broadway</td>\n",
       "      <td>40.793773</td>\n",
       "      <td>-73.971886</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1166</th>\n",
       "      <td>3307</td>\n",
       "      <td>West End Ave &amp; W 94 St</td>\n",
       "      <td>40.794165</td>\n",
       "      <td>-73.974123</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1167</th>\n",
       "      <td>3307</td>\n",
       "      <td>West End Ave &amp; W 94 St</td>\n",
       "      <td>40.794168</td>\n",
       "      <td>-73.974121</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1207</th>\n",
       "      <td>3328</td>\n",
       "      <td>W 100 St &amp; Manhattan Ave</td>\n",
       "      <td>40.794996</td>\n",
       "      <td>-73.964502</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1206</th>\n",
       "      <td>3328</td>\n",
       "      <td>W 100 St &amp; Manhattan Ave</td>\n",
       "      <td>40.795000</td>\n",
       "      <td>-73.964500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1229</th>\n",
       "      <td>3341</td>\n",
       "      <td>Central Park West &amp; W 102 St</td>\n",
       "      <td>40.795345</td>\n",
       "      <td>-73.961860</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1228</th>\n",
       "      <td>3341</td>\n",
       "      <td>Central Park West &amp; W 102 St</td>\n",
       "      <td>40.795347</td>\n",
       "      <td>-73.961864</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1341</th>\n",
       "      <td>3400</td>\n",
       "      <td>E 110 St &amp; Madison Ave</td>\n",
       "      <td>40.796155</td>\n",
       "      <td>-73.947823</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1340</th>\n",
       "      <td>3400</td>\n",
       "      <td>E 110 St &amp; Madison Ave</td>\n",
       "      <td>40.796157</td>\n",
       "      <td>-73.947824</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1157</th>\n",
       "      <td>3302</td>\n",
       "      <td>Columbus Ave &amp; W 103 St</td>\n",
       "      <td>40.796935</td>\n",
       "      <td>-73.964336</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1156</th>\n",
       "      <td>3302</td>\n",
       "      <td>Columbus Ave &amp; W 103 St</td>\n",
       "      <td>40.796937</td>\n",
       "      <td>-73.964344</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1246</th>\n",
       "      <td>3350</td>\n",
       "      <td>W 100 St &amp; Broadway</td>\n",
       "      <td>40.797368</td>\n",
       "      <td>-73.970411</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1247</th>\n",
       "      <td>3350</td>\n",
       "      <td>W 100 St &amp; Broadway</td>\n",
       "      <td>40.797371</td>\n",
       "      <td>-73.970416</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1196</th>\n",
       "      <td>3323</td>\n",
       "      <td>W 106 St &amp; Central Park West</td>\n",
       "      <td>40.798183</td>\n",
       "      <td>-73.960594</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1197</th>\n",
       "      <td>3323</td>\n",
       "      <td>W 106 St &amp; Central Park West</td>\n",
       "      <td>40.798191</td>\n",
       "      <td>-73.960598</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1185</th>\n",
       "      <td>3316</td>\n",
       "      <td>W 104 St &amp; Amsterdam Ave</td>\n",
       "      <td>40.798991</td>\n",
       "      <td>-73.966219</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1184</th>\n",
       "      <td>3316</td>\n",
       "      <td>W 104 St &amp; Amsterdam Ave</td>\n",
       "      <td>40.798991</td>\n",
       "      <td>-73.966217</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1291</th>\n",
       "      <td>3374</td>\n",
       "      <td>Central Park North &amp; Adam Clayton Powell Blvd</td>\n",
       "      <td>40.799484</td>\n",
       "      <td>-73.955612</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1292</th>\n",
       "      <td>3374</td>\n",
       "      <td>Central Park North &amp; Adam Clayton Powell Blvd</td>\n",
       "      <td>40.799486</td>\n",
       "      <td>-73.955614</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1232</th>\n",
       "      <td>3343</td>\n",
       "      <td>W 107 St &amp; Columbus Ave</td>\n",
       "      <td>40.799754</td>\n",
       "      <td>-73.962110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1233</th>\n",
       "      <td>3343</td>\n",
       "      <td>W 107 St &amp; Columbus Ave</td>\n",
       "      <td>40.799755</td>\n",
       "      <td>-73.962108</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1259</th>\n",
       "      <td>3357</td>\n",
       "      <td>W 106 St &amp; Amsterdam Ave</td>\n",
       "      <td>40.800833</td>\n",
       "      <td>-73.966447</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1258</th>\n",
       "      <td>3357</td>\n",
       "      <td>W 106 St &amp; Amsterdam Ave</td>\n",
       "      <td>40.800834</td>\n",
       "      <td>-73.966450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1213</th>\n",
       "      <td>3331</td>\n",
       "      <td>Riverside Dr &amp; W 104 St</td>\n",
       "      <td>40.801342</td>\n",
       "      <td>-73.971141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1212</th>\n",
       "      <td>3331</td>\n",
       "      <td>Riverside Dr &amp; W 104 St</td>\n",
       "      <td>40.801345</td>\n",
       "      <td>-73.971141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1277</th>\n",
       "      <td>3366</td>\n",
       "      <td>West End Ave &amp; W 107 St</td>\n",
       "      <td>40.802117</td>\n",
       "      <td>-73.968177</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1276</th>\n",
       "      <td>3366</td>\n",
       "      <td>West End Ave &amp; W 107 St</td>\n",
       "      <td>40.802117</td>\n",
       "      <td>-73.968177</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1307</th>\n",
       "      <td>3383</td>\n",
       "      <td>Cathedral Pkwy &amp; Broadway</td>\n",
       "      <td>40.804216</td>\n",
       "      <td>-73.966983</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1308</th>\n",
       "      <td>3383</td>\n",
       "      <td>Cathedral Pkwy &amp; Broadway</td>\n",
       "      <td>40.804218</td>\n",
       "      <td>-73.966992</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1413 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        id                                           name        lat  \\\n",
       "1074  3239                                       Bressler  40.646539   \n",
       "1083  3245                        Kiosk in a box Motivate  40.646677   \n",
       "734   3040                              SSP Tech Workshop  40.646678   \n",
       "733   3040                              SSP Tech Workshop  40.646679   \n",
       "116    255                              NYCBS Depot - SSP  40.646765   \n",
       "117    255                              NYCBS Depot - SSP  40.646766   \n",
       "731   3036                                      8D OPS 01  40.651489   \n",
       "1384  3423                West Drive & Prospect Park West  40.661064   \n",
       "1385  3423                West Drive & Prospect Park West  40.661066   \n",
       "1400  3432  Bike in Movie Night | Prospect Park Bandshell  40.662987   \n",
       "1401  3432  Bike in Movie Night | Prospect Park Bandshell  40.662988   \n",
       "1172  3310                                  14 St & 7 Ave  40.663779   \n",
       "1173  3310                                  14 St & 7 Ave  40.663781   \n",
       "1153  3300                      Prospect Park West & 8 St  40.665146   \n",
       "1152  3300                      Prospect Park West & 8 St  40.665147   \n",
       "1165  3306                                  10 St & 7 Ave  40.666206   \n",
       "1164  3306                                  10 St & 7 Ave  40.666208   \n",
       "1188  3319                                  14 St & 5 Ave  40.666285   \n",
       "1189  3319                                  14 St & 5 Ave  40.666287   \n",
       "1178  3313                                  6 Ave & 12 St  40.666319   \n",
       "1179  3313                                  6 Ave & 12 St  40.666319   \n",
       "1160  3304                                   6 Ave & 9 St  40.668124   \n",
       "1161  3304                                   6 Ave & 9 St  40.668125   \n",
       "1252  3354                      3 St & Prospect Park West  40.668132   \n",
       "1253  3354                      3 St & Prospect Park West  40.668133   \n",
       "1198  3324                                  3 Ave & 14 St  40.668544   \n",
       "1199  3324                                  3 Ave & 14 St  40.668544   \n",
       "1194  3322                                  12 St & 4 Ave  40.668601   \n",
       "1195  3322                                  12 St & 4 Ave  40.668602   \n",
       "1186  3317                                  10 St & 5 Ave  40.668628   \n",
       "...    ...                                            ...        ...   \n",
       "1181  3314                             W 95 St & Broadway  40.793769   \n",
       "1180  3314                             W 95 St & Broadway  40.793773   \n",
       "1166  3307                         West End Ave & W 94 St  40.794165   \n",
       "1167  3307                         West End Ave & W 94 St  40.794168   \n",
       "1207  3328                       W 100 St & Manhattan Ave  40.794996   \n",
       "1206  3328                       W 100 St & Manhattan Ave  40.795000   \n",
       "1229  3341                   Central Park West & W 102 St  40.795345   \n",
       "1228  3341                   Central Park West & W 102 St  40.795347   \n",
       "1341  3400                         E 110 St & Madison Ave  40.796155   \n",
       "1340  3400                         E 110 St & Madison Ave  40.796157   \n",
       "1157  3302                        Columbus Ave & W 103 St  40.796935   \n",
       "1156  3302                        Columbus Ave & W 103 St  40.796937   \n",
       "1246  3350                            W 100 St & Broadway  40.797368   \n",
       "1247  3350                            W 100 St & Broadway  40.797371   \n",
       "1196  3323                   W 106 St & Central Park West  40.798183   \n",
       "1197  3323                   W 106 St & Central Park West  40.798191   \n",
       "1185  3316                       W 104 St & Amsterdam Ave  40.798991   \n",
       "1184  3316                       W 104 St & Amsterdam Ave  40.798991   \n",
       "1291  3374  Central Park North & Adam Clayton Powell Blvd  40.799484   \n",
       "1292  3374  Central Park North & Adam Clayton Powell Blvd  40.799486   \n",
       "1232  3343                        W 107 St & Columbus Ave  40.799754   \n",
       "1233  3343                        W 107 St & Columbus Ave  40.799755   \n",
       "1259  3357                       W 106 St & Amsterdam Ave  40.800833   \n",
       "1258  3357                       W 106 St & Amsterdam Ave  40.800834   \n",
       "1213  3331                        Riverside Dr & W 104 St  40.801342   \n",
       "1212  3331                        Riverside Dr & W 104 St  40.801345   \n",
       "1277  3366                        West End Ave & W 107 St  40.802117   \n",
       "1276  3366                        West End Ave & W 107 St  40.802117   \n",
       "1307  3383                      Cathedral Pkwy & Broadway  40.804216   \n",
       "1308  3383                      Cathedral Pkwy & Broadway  40.804218   \n",
       "\n",
       "            lon  \n",
       "1074 -74.016588  \n",
       "1083 -74.016298  \n",
       "734  -74.016262  \n",
       "733  -74.016269  \n",
       "116  -74.016513  \n",
       "117  -74.016510  \n",
       "731  -74.026636  \n",
       "1384 -73.979458  \n",
       "1385 -73.979451  \n",
       "1400 -73.976919  \n",
       "1401 -73.976922  \n",
       "1172 -73.983970  \n",
       "1173 -73.983969  \n",
       "1153 -73.976375  \n",
       "1152 -73.976377  \n",
       "1165 -73.982001  \n",
       "1164 -73.982001  \n",
       "1188 -73.988950  \n",
       "1189 -73.988959  \n",
       "1178 -73.985456  \n",
       "1179 -73.985458  \n",
       "1160 -73.983782  \n",
       "1161 -73.983779  \n",
       "1252 -73.973639  \n",
       "1253 -73.973642  \n",
       "1198 -73.993327  \n",
       "1199 -73.993333  \n",
       "1194 -73.990444  \n",
       "1195 -73.990439  \n",
       "1186 -73.987002  \n",
       "...         ...  \n",
       "1181 -73.971884  \n",
       "1180 -73.971886  \n",
       "1166 -73.974123  \n",
       "1167 -73.974121  \n",
       "1207 -73.964502  \n",
       "1206 -73.964500  \n",
       "1229 -73.961860  \n",
       "1228 -73.961864  \n",
       "1341 -73.947823  \n",
       "1340 -73.947824  \n",
       "1157 -73.964336  \n",
       "1156 -73.964344  \n",
       "1246 -73.970411  \n",
       "1247 -73.970416  \n",
       "1196 -73.960594  \n",
       "1197 -73.960598  \n",
       "1185 -73.966219  \n",
       "1184 -73.966217  \n",
       "1291 -73.955612  \n",
       "1292 -73.955614  \n",
       "1232 -73.962110  \n",
       "1233 -73.962108  \n",
       "1259 -73.966447  \n",
       "1258 -73.966450  \n",
       "1213 -73.971141  \n",
       "1212 -73.971141  \n",
       "1277 -73.968177  \n",
       "1276 -73.968177  \n",
       "1307 -73.966983  \n",
       "1308 -73.966992  \n",
       "\n",
       "[1413 rows x 4 columns]"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c.sort_values(['lat', 'lon'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>stationName</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>639</th>\n",
       "      <td>3423</td>\n",
       "      <td>West Drive &amp; Prospect Park West</td>\n",
       "      <td>40.661063</td>\n",
       "      <td>-73.979453</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>530</th>\n",
       "      <td>3310</td>\n",
       "      <td>14 St &amp; 7 Ave</td>\n",
       "      <td>40.663779</td>\n",
       "      <td>-73.983968</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>520</th>\n",
       "      <td>3300</td>\n",
       "      <td>Prospect Park West &amp; 8 St</td>\n",
       "      <td>40.665147</td>\n",
       "      <td>-73.976376</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>526</th>\n",
       "      <td>3306</td>\n",
       "      <td>10 St &amp; 7 Ave</td>\n",
       "      <td>40.666208</td>\n",
       "      <td>-73.981999</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>539</th>\n",
       "      <td>3319</td>\n",
       "      <td>14 St &amp; 5 Ave</td>\n",
       "      <td>40.666287</td>\n",
       "      <td>-73.988951</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>533</th>\n",
       "      <td>3313</td>\n",
       "      <td>6 Ave &amp; 12 St</td>\n",
       "      <td>40.666318</td>\n",
       "      <td>-73.985462</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>524</th>\n",
       "      <td>3304</td>\n",
       "      <td>6 Ave &amp; 9 St</td>\n",
       "      <td>40.668127</td>\n",
       "      <td>-73.983776</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>573</th>\n",
       "      <td>3354</td>\n",
       "      <td>3 St &amp; Prospect Park West</td>\n",
       "      <td>40.668132</td>\n",
       "      <td>-73.973638</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>544</th>\n",
       "      <td>3324</td>\n",
       "      <td>3 Ave &amp; 14 St</td>\n",
       "      <td>40.668546</td>\n",
       "      <td>-73.993333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>542</th>\n",
       "      <td>3322</td>\n",
       "      <td>12 St &amp; 4 Ave</td>\n",
       "      <td>40.668603</td>\n",
       "      <td>-73.990439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>537</th>\n",
       "      <td>3317</td>\n",
       "      <td>10 St &amp; 5 Ave</td>\n",
       "      <td>40.668627</td>\n",
       "      <td>-73.987001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>517</th>\n",
       "      <td>3297</td>\n",
       "      <td>6 St &amp; 7 Ave</td>\n",
       "      <td>40.668663</td>\n",
       "      <td>-73.979881</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>584</th>\n",
       "      <td>3365</td>\n",
       "      <td>3 St &amp; 7 Ave</td>\n",
       "      <td>40.670384</td>\n",
       "      <td>-73.978397</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>622</th>\n",
       "      <td>3405</td>\n",
       "      <td>5 St &amp; 6 Ave</td>\n",
       "      <td>40.670484</td>\n",
       "      <td>-73.982090</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>621</th>\n",
       "      <td>3404</td>\n",
       "      <td>7 St &amp; 5 Ave</td>\n",
       "      <td>40.670492</td>\n",
       "      <td>-73.985417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>620</th>\n",
       "      <td>3403</td>\n",
       "      <td>4 Ave &amp; 9 St</td>\n",
       "      <td>40.670513</td>\n",
       "      <td>-73.988766</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>577</th>\n",
       "      <td>3358</td>\n",
       "      <td>Garfield Pl &amp; 8 Ave</td>\n",
       "      <td>40.671198</td>\n",
       "      <td>-73.974841</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>618</th>\n",
       "      <td>3401</td>\n",
       "      <td>2 Ave &amp; 9 St</td>\n",
       "      <td>40.672481</td>\n",
       "      <td>-73.993314</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>550</th>\n",
       "      <td>3330</td>\n",
       "      <td>Henry St &amp; Bay St</td>\n",
       "      <td>40.672506</td>\n",
       "      <td>-74.004947</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>616</th>\n",
       "      <td>3399</td>\n",
       "      <td>7 St &amp; 3 Ave</td>\n",
       "      <td>40.672603</td>\n",
       "      <td>-73.989830</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>571</th>\n",
       "      <td>3352</td>\n",
       "      <td>Sigourney St &amp; Columbia St</td>\n",
       "      <td>40.672672</td>\n",
       "      <td>-74.008795</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>587</th>\n",
       "      <td>3368</td>\n",
       "      <td>5 Ave &amp; 3 St</td>\n",
       "      <td>40.672815</td>\n",
       "      <td>-73.983524</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>568</th>\n",
       "      <td>3349</td>\n",
       "      <td>Grand Army Plaza &amp; Plaza St West</td>\n",
       "      <td>40.672968</td>\n",
       "      <td>-73.970880</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>556</th>\n",
       "      <td>3337</td>\n",
       "      <td>Dwight St &amp; Van Dyke St</td>\n",
       "      <td>40.673636</td>\n",
       "      <td>-74.011956</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>580</th>\n",
       "      <td>3361</td>\n",
       "      <td>Carroll St &amp; 6 Ave</td>\n",
       "      <td>40.674089</td>\n",
       "      <td>-73.978728</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>546</th>\n",
       "      <td>3326</td>\n",
       "      <td>Clinton St &amp; Centre St</td>\n",
       "      <td>40.674340</td>\n",
       "      <td>-74.001947</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>590</th>\n",
       "      <td>3371</td>\n",
       "      <td>4 Ave &amp; 2 St</td>\n",
       "      <td>40.674613</td>\n",
       "      <td>-73.985011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>615</th>\n",
       "      <td>3398</td>\n",
       "      <td>Smith St &amp; 9 St</td>\n",
       "      <td>40.674696</td>\n",
       "      <td>-73.997858</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>553</th>\n",
       "      <td>3333</td>\n",
       "      <td>Columbia St &amp; Lorraine St</td>\n",
       "      <td>40.674706</td>\n",
       "      <td>-74.007557</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>572</th>\n",
       "      <td>3353</td>\n",
       "      <td>Reed St &amp; Van Brunt St</td>\n",
       "      <td>40.674784</td>\n",
       "      <td>-74.016128</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>608</th>\n",
       "      <td>3391</td>\n",
       "      <td>E 106 St &amp; 1 Ave</td>\n",
       "      <td>40.789253</td>\n",
       "      <td>-73.939562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>564</th>\n",
       "      <td>3345</td>\n",
       "      <td>Madison Ave &amp; E 99 St</td>\n",
       "      <td>40.789485</td>\n",
       "      <td>-73.952429</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>510</th>\n",
       "      <td>3289</td>\n",
       "      <td>W 90 St &amp; Amsterdam Ave</td>\n",
       "      <td>40.790179</td>\n",
       "      <td>-73.972889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>647</th>\n",
       "      <td>3434</td>\n",
       "      <td>W 88 St &amp; West End Ave</td>\n",
       "      <td>40.790254</td>\n",
       "      <td>-73.977183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>598</th>\n",
       "      <td>3379</td>\n",
       "      <td>E 103 St &amp; Lexington Ave</td>\n",
       "      <td>40.790305</td>\n",
       "      <td>-73.947558</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>582</th>\n",
       "      <td>3363</td>\n",
       "      <td>E 102 St &amp; Park Ave</td>\n",
       "      <td>40.790483</td>\n",
       "      <td>-73.950331</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>515</th>\n",
       "      <td>3295</td>\n",
       "      <td>Central Park W &amp; W 96 St</td>\n",
       "      <td>40.791270</td>\n",
       "      <td>-73.964839</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>653</th>\n",
       "      <td>3445</td>\n",
       "      <td>Riverside Dr &amp; W 89 St</td>\n",
       "      <td>40.791812</td>\n",
       "      <td>-73.978602</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>521</th>\n",
       "      <td>3301</td>\n",
       "      <td>Columbus Ave &amp; W 95 St</td>\n",
       "      <td>40.791956</td>\n",
       "      <td>-73.968087</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>640</th>\n",
       "      <td>3424</td>\n",
       "      <td>E 106 St &amp; Lexington Ave</td>\n",
       "      <td>40.791976</td>\n",
       "      <td>-73.945993</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>513</th>\n",
       "      <td>3293</td>\n",
       "      <td>W 92 St &amp; Broadway</td>\n",
       "      <td>40.792100</td>\n",
       "      <td>-73.973900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>586</th>\n",
       "      <td>3367</td>\n",
       "      <td>5 Ave &amp; E 103 St</td>\n",
       "      <td>40.792255</td>\n",
       "      <td>-73.952499</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>607</th>\n",
       "      <td>3390</td>\n",
       "      <td>E 109 St &amp; 3 Ave</td>\n",
       "      <td>40.793297</td>\n",
       "      <td>-73.943208</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>540</th>\n",
       "      <td>3320</td>\n",
       "      <td>Central Park West &amp; W 100 St</td>\n",
       "      <td>40.793393</td>\n",
       "      <td>-73.963556</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>604</th>\n",
       "      <td>3387</td>\n",
       "      <td>E 106 St &amp; Madison Ave</td>\n",
       "      <td>40.793434</td>\n",
       "      <td>-73.949450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>534</th>\n",
       "      <td>3314</td>\n",
       "      <td>W 95 St &amp; Broadway</td>\n",
       "      <td>40.793770</td>\n",
       "      <td>-73.971888</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>527</th>\n",
       "      <td>3307</td>\n",
       "      <td>West End Ave &amp; W 94 St</td>\n",
       "      <td>40.794165</td>\n",
       "      <td>-73.974124</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>548</th>\n",
       "      <td>3328</td>\n",
       "      <td>W 100 St &amp; Manhattan Ave</td>\n",
       "      <td>40.795000</td>\n",
       "      <td>-73.964500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>560</th>\n",
       "      <td>3341</td>\n",
       "      <td>Central Park West &amp; W 102 St</td>\n",
       "      <td>40.795346</td>\n",
       "      <td>-73.961860</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>617</th>\n",
       "      <td>3400</td>\n",
       "      <td>E 110 St &amp; Madison Ave</td>\n",
       "      <td>40.796154</td>\n",
       "      <td>-73.947821</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>522</th>\n",
       "      <td>3302</td>\n",
       "      <td>Columbus Ave &amp; W 103 St</td>\n",
       "      <td>40.796935</td>\n",
       "      <td>-73.964341</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>569</th>\n",
       "      <td>3350</td>\n",
       "      <td>W 100 St &amp; Broadway</td>\n",
       "      <td>40.797372</td>\n",
       "      <td>-73.970412</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>543</th>\n",
       "      <td>3323</td>\n",
       "      <td>W 106 St &amp; Central Park West</td>\n",
       "      <td>40.798186</td>\n",
       "      <td>-73.960591</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>536</th>\n",
       "      <td>3316</td>\n",
       "      <td>W 104 St &amp; Amsterdam Ave</td>\n",
       "      <td>40.798994</td>\n",
       "      <td>-73.966217</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>593</th>\n",
       "      <td>3374</td>\n",
       "      <td>Central Park North &amp; Adam Clayton Powell Blvd</td>\n",
       "      <td>40.799484</td>\n",
       "      <td>-73.955613</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>562</th>\n",
       "      <td>3343</td>\n",
       "      <td>W 107 St &amp; Columbus Ave</td>\n",
       "      <td>40.799757</td>\n",
       "      <td>-73.962113</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>576</th>\n",
       "      <td>3357</td>\n",
       "      <td>W 106 St &amp; Amsterdam Ave</td>\n",
       "      <td>40.800836</td>\n",
       "      <td>-73.966449</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>551</th>\n",
       "      <td>3331</td>\n",
       "      <td>Riverside Dr &amp; W 104 St</td>\n",
       "      <td>40.801343</td>\n",
       "      <td>-73.971146</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>585</th>\n",
       "      <td>3366</td>\n",
       "      <td>West End Ave &amp; W 107 St</td>\n",
       "      <td>40.802117</td>\n",
       "      <td>-73.968181</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>601</th>\n",
       "      <td>3383</td>\n",
       "      <td>Cathedral Pkwy &amp; Broadway</td>\n",
       "      <td>40.804213</td>\n",
       "      <td>-73.966991</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>664 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       id                                    stationName   latitude  longitude\n",
       "639  3423                West Drive & Prospect Park West  40.661063 -73.979453\n",
       "530  3310                                  14 St & 7 Ave  40.663779 -73.983968\n",
       "520  3300                      Prospect Park West & 8 St  40.665147 -73.976376\n",
       "526  3306                                  10 St & 7 Ave  40.666208 -73.981999\n",
       "539  3319                                  14 St & 5 Ave  40.666287 -73.988951\n",
       "533  3313                                  6 Ave & 12 St  40.666318 -73.985462\n",
       "524  3304                                   6 Ave & 9 St  40.668127 -73.983776\n",
       "573  3354                      3 St & Prospect Park West  40.668132 -73.973638\n",
       "544  3324                                  3 Ave & 14 St  40.668546 -73.993333\n",
       "542  3322                                  12 St & 4 Ave  40.668603 -73.990439\n",
       "537  3317                                  10 St & 5 Ave  40.668627 -73.987001\n",
       "517  3297                                   6 St & 7 Ave  40.668663 -73.979881\n",
       "584  3365                                   3 St & 7 Ave  40.670384 -73.978397\n",
       "622  3405                                   5 St & 6 Ave  40.670484 -73.982090\n",
       "621  3404                                   7 St & 5 Ave  40.670492 -73.985417\n",
       "620  3403                                   4 Ave & 9 St  40.670513 -73.988766\n",
       "577  3358                            Garfield Pl & 8 Ave  40.671198 -73.974841\n",
       "618  3401                                   2 Ave & 9 St  40.672481 -73.993314\n",
       "550  3330                              Henry St & Bay St  40.672506 -74.004947\n",
       "616  3399                                   7 St & 3 Ave  40.672603 -73.989830\n",
       "571  3352                     Sigourney St & Columbia St  40.672672 -74.008795\n",
       "587  3368                                   5 Ave & 3 St  40.672815 -73.983524\n",
       "568  3349               Grand Army Plaza & Plaza St West  40.672968 -73.970880\n",
       "556  3337                        Dwight St & Van Dyke St  40.673636 -74.011956\n",
       "580  3361                             Carroll St & 6 Ave  40.674089 -73.978728\n",
       "546  3326                         Clinton St & Centre St  40.674340 -74.001947\n",
       "590  3371                                   4 Ave & 2 St  40.674613 -73.985011\n",
       "615  3398                                Smith St & 9 St  40.674696 -73.997858\n",
       "553  3333                      Columbia St & Lorraine St  40.674706 -74.007557\n",
       "572  3353                         Reed St & Van Brunt St  40.674784 -74.016128\n",
       "..    ...                                            ...        ...        ...\n",
       "608  3391                               E 106 St & 1 Ave  40.789253 -73.939562\n",
       "564  3345                          Madison Ave & E 99 St  40.789485 -73.952429\n",
       "510  3289                        W 90 St & Amsterdam Ave  40.790179 -73.972889\n",
       "647  3434                         W 88 St & West End Ave  40.790254 -73.977183\n",
       "598  3379                       E 103 St & Lexington Ave  40.790305 -73.947558\n",
       "582  3363                            E 102 St & Park Ave  40.790483 -73.950331\n",
       "515  3295                       Central Park W & W 96 St  40.791270 -73.964839\n",
       "653  3445                         Riverside Dr & W 89 St  40.791812 -73.978602\n",
       "521  3301                         Columbus Ave & W 95 St  40.791956 -73.968087\n",
       "640  3424                       E 106 St & Lexington Ave  40.791976 -73.945993\n",
       "513  3293                             W 92 St & Broadway  40.792100 -73.973900\n",
       "586  3367                               5 Ave & E 103 St  40.792255 -73.952499\n",
       "607  3390                               E 109 St & 3 Ave  40.793297 -73.943208\n",
       "540  3320                   Central Park West & W 100 St  40.793393 -73.963556\n",
       "604  3387                         E 106 St & Madison Ave  40.793434 -73.949450\n",
       "534  3314                             W 95 St & Broadway  40.793770 -73.971888\n",
       "527  3307                         West End Ave & W 94 St  40.794165 -73.974124\n",
       "548  3328                       W 100 St & Manhattan Ave  40.795000 -73.964500\n",
       "560  3341                   Central Park West & W 102 St  40.795346 -73.961860\n",
       "617  3400                         E 110 St & Madison Ave  40.796154 -73.947821\n",
       "522  3302                        Columbus Ave & W 103 St  40.796935 -73.964341\n",
       "569  3350                            W 100 St & Broadway  40.797372 -73.970412\n",
       "543  3323                   W 106 St & Central Park West  40.798186 -73.960591\n",
       "536  3316                       W 104 St & Amsterdam Ave  40.798994 -73.966217\n",
       "593  3374  Central Park North & Adam Clayton Powell Blvd  40.799484 -73.955613\n",
       "562  3343                        W 107 St & Columbus Ave  40.799757 -73.962113\n",
       "576  3357                       W 106 St & Amsterdam Ave  40.800836 -73.966449\n",
       "551  3331                        Riverside Dr & W 104 St  40.801343 -73.971146\n",
       "585  3366                        West End Ave & W 107 St  40.802117 -73.968181\n",
       "601  3383                      Cathedral Pkwy & Broadway  40.804213 -73.966991\n",
       "\n",
       "[664 rows x 4 columns]"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zz[['id', 'stationName', 'latitude', 'longitude']].sort_values(['latitude', 'longitude'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import sklearn.neighbors"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class BallTree in module sklearn.neighbors.ball_tree:\n",
      "\n",
      "class BallTree(BinaryTree)\n",
      " |  BallTree for fast generalized N-point problems\n",
      " |  \n",
      " |  BallTree(X, leaf_size=40, metric='minkowski', \\**kwargs)\n",
      " |  \n",
      " |  Parameters\n",
      " |  ----------\n",
      " |  X : array-like, shape = [n_samples, n_features]\n",
      " |      n_samples is the number of points in the data set, and\n",
      " |      n_features is the dimension of the parameter space.\n",
      " |      Note: if X is a C-contiguous array of doubles then data will\n",
      " |      not be copied. Otherwise, an internal copy will be made.\n",
      " |  \n",
      " |  leaf_size : positive integer (default = 40)\n",
      " |      Number of points at which to switch to brute-force. Changing\n",
      " |      leaf_size will not affect the results of a query, but can\n",
      " |      significantly impact the speed of a query and the memory required\n",
      " |      to store the constructed tree.  The amount of memory needed to\n",
      " |      store the tree scales as approximately n_samples / leaf_size.\n",
      " |      For a specified ``leaf_size``, a leaf node is guaranteed to\n",
      " |      satisfy ``leaf_size <= n_points <= 2 * leaf_size``, except in\n",
      " |      the case that ``n_samples < leaf_size``.\n",
      " |  \n",
      " |  metric : string or DistanceMetric object\n",
      " |      the distance metric to use for the tree.  Default='minkowski'\n",
      " |      with p=2 (that is, a euclidean metric). See the documentation\n",
      " |      of the DistanceMetric class for a list of available metrics.\n",
      " |      ball_tree.valid_metrics gives a list of the metrics which\n",
      " |      are valid for BallTree.\n",
      " |  \n",
      " |  Additional keywords are passed to the distance metric class.\n",
      " |  \n",
      " |  Attributes\n",
      " |  ----------\n",
      " |  data : np.ndarray\n",
      " |      The training data\n",
      " |  \n",
      " |  Examples\n",
      " |  --------\n",
      " |  Query for k-nearest neighbors\n",
      " |  \n",
      " |      >>> import numpy as np\n",
      " |      >>> np.random.seed(0)\n",
      " |      >>> X = np.random.random((10, 3))  # 10 points in 3 dimensions\n",
      " |      >>> tree = BallTree(X, leaf_size=2)              # doctest: +SKIP\n",
      " |      >>> dist, ind = tree.query([X[0]], k=3)                # doctest: +SKIP\n",
      " |      >>> print ind  # indices of 3 closest neighbors\n",
      " |      [0 3 1]\n",
      " |      >>> print dist  # distances to 3 closest neighbors\n",
      " |      [ 0.          0.19662693  0.29473397]\n",
      " |  \n",
      " |  Pickle and Unpickle a tree.  Note that the state of the tree is saved in the\n",
      " |  pickle operation: the tree needs not be rebuilt upon unpickling.\n",
      " |  \n",
      " |      >>> import numpy as np\n",
      " |      >>> import pickle\n",
      " |      >>> np.random.seed(0)\n",
      " |      >>> X = np.random.random((10, 3))  # 10 points in 3 dimensions\n",
      " |      >>> tree = BallTree(X, leaf_size=2)        # doctest: +SKIP\n",
      " |      >>> s = pickle.dumps(tree)                     # doctest: +SKIP\n",
      " |      >>> tree_copy = pickle.loads(s)                # doctest: +SKIP\n",
      " |      >>> dist, ind = tree_copy.query(X[0], k=3)     # doctest: +SKIP\n",
      " |      >>> print ind  # indices of 3 closest neighbors\n",
      " |      [0 3 1]\n",
      " |      >>> print dist  # distances to 3 closest neighbors\n",
      " |      [ 0.          0.19662693  0.29473397]\n",
      " |  \n",
      " |  Query for neighbors within a given radius\n",
      " |  \n",
      " |      >>> import numpy as np\n",
      " |      >>> np.random.seed(0)\n",
      " |      >>> X = np.random.random((10, 3))  # 10 points in 3 dimensions\n",
      " |      >>> tree = BallTree(X, leaf_size=2)     # doctest: +SKIP\n",
      " |      >>> print tree.query_radius(X[0], r=0.3, count_only=True)\n",
      " |      3\n",
      " |      >>> ind = tree.query_radius(X[0], r=0.3)  # doctest: +SKIP\n",
      " |      >>> print ind  # indices of neighbors within distance 0.3\n",
      " |      [3 0 1]\n",
      " |  \n",
      " |  \n",
      " |  Compute a gaussian kernel density estimate:\n",
      " |  \n",
      " |      >>> import numpy as np\n",
      " |      >>> np.random.seed(1)\n",
      " |      >>> X = np.random.random((100, 3))\n",
      " |      >>> tree = BallTree(X)                # doctest: +SKIP\n",
      " |      >>> tree.kernel_density(X[:3], h=0.1, kernel='gaussian')\n",
      " |      array([ 6.94114649,  7.83281226,  7.2071716 ])\n",
      " |  \n",
      " |  Compute a two-point auto-correlation function\n",
      " |  \n",
      " |      >>> import numpy as np\n",
      " |      >>> np.random.seed(0)\n",
      " |      >>> X = np.random.random((30, 3))\n",
      " |      >>> r = np.linspace(0, 1, 5)\n",
      " |      >>> tree = BallTree(X)                # doctest: +SKIP\n",
      " |      >>> tree.two_point_correlation(X, r)\n",
      " |      array([ 30,  62, 278, 580, 820])\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      BallTree\n",
      " |      BinaryTree\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __new__(*args, **kwargs) from builtins.type\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  __pyx_vtable__ = <capsule object NULL>\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from BinaryTree:\n",
      " |  \n",
      " |  __getstate__(...)\n",
      " |      get state for pickling\n",
      " |  \n",
      " |  __init__(self, /, *args, **kwargs)\n",
      " |      Initialize self.  See help(type(self)) for accurate signature.\n",
      " |  \n",
      " |  __reduce__(...)\n",
      " |      reduce method used for pickling\n",
      " |  \n",
      " |  __setstate__(...)\n",
      " |      set state for pickling\n",
      " |  \n",
      " |  get_arrays(...)\n",
      " |  \n",
      " |  get_n_calls(...)\n",
      " |  \n",
      " |  get_tree_stats(...)\n",
      " |  \n",
      " |  kernel_density(...)\n",
      " |      kernel_density(self, X, h, kernel='gaussian', atol=0, rtol=1E-8,\n",
      " |                     breadth_first=True, return_log=False)\n",
      " |      \n",
      " |      Compute the kernel density estimate at points X with the given kernel,\n",
      " |      using the distance metric specified at tree creation.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : array_like\n",
      " |          An array of points to query.  Last dimension should match dimension\n",
      " |          of training data.\n",
      " |      h : float\n",
      " |          the bandwidth of the kernel\n",
      " |      kernel : string\n",
      " |          specify the kernel to use.  Options are\n",
      " |          - 'gaussian'\n",
      " |          - 'tophat'\n",
      " |          - 'epanechnikov'\n",
      " |          - 'exponential'\n",
      " |          - 'linear'\n",
      " |          - 'cosine'\n",
      " |          Default is kernel = 'gaussian'\n",
      " |      atol, rtol : float (default = 0)\n",
      " |          Specify the desired relative and absolute tolerance of the result.\n",
      " |          If the true result is K_true, then the returned result K_ret\n",
      " |          satisfies ``abs(K_true - K_ret) < atol + rtol * K_ret``\n",
      " |          The default is zero (i.e. machine precision) for both.\n",
      " |      breadth_first : boolean (default = False)\n",
      " |          if True, use a breadth-first search.  If False (default) use a\n",
      " |          depth-first search.  Breadth-first is generally faster for\n",
      " |          compact kernels and/or high tolerances.\n",
      " |      return_log : boolean (default = False)\n",
      " |          return the logarithm of the result.  This can be more accurate\n",
      " |          than returning the result itself for narrow kernels.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      density : ndarray\n",
      " |          The array of (log)-density evaluations, shape = X.shape[:-1]\n",
      " |      \n",
      " |      Examples\n",
      " |      --------\n",
      " |      Compute a gaussian kernel density estimate:\n",
      " |      \n",
      " |      >>> import numpy as np\n",
      " |      >>> np.random.seed(1)\n",
      " |      >>> X = np.random.random((100, 3))\n",
      " |      >>> tree = BinaryTree(X)           # doctest: +SKIP\n",
      " |      >>> tree.kernel_density(X[:3], h=0.1, kernel='gaussian')\n",
      " |      array([ 6.94114649,  7.83281226,  7.2071716 ])\n",
      " |  \n",
      " |  query(...)\n",
      " |      query(X, k=1, return_distance=True,\n",
      " |            dualtree=False, breadth_first=False)\n",
      " |      \n",
      " |      query the tree for the k nearest neighbors\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : array-like, last dimension self.dim\n",
      " |          An array of points to query\n",
      " |      k : integer  (default = 1)\n",
      " |          The number of nearest neighbors to return\n",
      " |      return_distance : boolean (default = True)\n",
      " |          if True, return a tuple (d, i) of distances and indices\n",
      " |          if False, return array i\n",
      " |      dualtree : boolean (default = False)\n",
      " |          if True, use the dual tree formalism for the query: a tree is\n",
      " |          built for the query points, and the pair of trees is used to\n",
      " |          efficiently search this space.  This can lead to better\n",
      " |          performance as the number of points grows large.\n",
      " |      breadth_first : boolean (default = False)\n",
      " |          if True, then query the nodes in a breadth-first manner.\n",
      " |          Otherwise, query the nodes in a depth-first manner.\n",
      " |      sort_results : boolean (default = True)\n",
      " |          if True, then distances and indices of each point are sorted\n",
      " |          on return, so that the first column contains the closest points.\n",
      " |          Otherwise, neighbors are returned in an arbitrary order.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      i    : if return_distance == False\n",
      " |      (d,i) : if return_distance == True\n",
      " |      \n",
      " |      d : array of doubles - shape: x.shape[:-1] + (k,)\n",
      " |          each entry gives the list of distances to the\n",
      " |          neighbors of the corresponding point\n",
      " |      \n",
      " |      i : array of integers - shape: x.shape[:-1] + (k,)\n",
      " |          each entry gives the list of indices of\n",
      " |          neighbors of the corresponding point\n",
      " |      \n",
      " |      Examples\n",
      " |      --------\n",
      " |      Query for k-nearest neighbors\n",
      " |      \n",
      " |          >>> import numpy as np\n",
      " |          >>> np.random.seed(0)\n",
      " |          >>> X = np.random.random((10, 3))  # 10 points in 3 dimensions\n",
      " |          >>> tree = BinaryTree(X, leaf_size=2)    # doctest: +SKIP\n",
      " |          >>> dist, ind = tree.query(X[0], k=3)    # doctest: +SKIP\n",
      " |          >>> print ind  # indices of 3 closest neighbors\n",
      " |          [0 3 1]\n",
      " |          >>> print dist  # distances to 3 closest neighbors\n",
      " |          [ 0.          0.19662693  0.29473397]\n",
      " |  \n",
      " |  query_radius(...)\n",
      " |      query_radius(self, X, r, count_only = False):\n",
      " |      \n",
      " |      query the tree for neighbors within a radius r\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : array-like, last dimension self.dim\n",
      " |          An array of points to query\n",
      " |      r : distance within which neighbors are returned\n",
      " |          r can be a single value, or an array of values of shape\n",
      " |          x.shape[:-1] if different radii are desired for each point.\n",
      " |      return_distance : boolean (default = False)\n",
      " |          if True,  return distances to neighbors of each point\n",
      " |          if False, return only neighbors\n",
      " |          Note that unlike the query() method, setting return_distance=True\n",
      " |          here adds to the computation time.  Not all distances need to be\n",
      " |          calculated explicitly for return_distance=False.  Results are\n",
      " |          not sorted by default: see ``sort_results`` keyword.\n",
      " |      count_only : boolean (default = False)\n",
      " |          if True,  return only the count of points within distance r\n",
      " |          if False, return the indices of all points within distance r\n",
      " |          If return_distance==True, setting count_only=True will\n",
      " |          result in an error.\n",
      " |      sort_results : boolean (default = False)\n",
      " |          if True, the distances and indices will be sorted before being\n",
      " |          returned.  If False, the results will not be sorted.  If\n",
      " |          return_distance == False, setting sort_results = True will\n",
      " |          result in an error.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      count       : if count_only == True\n",
      " |      ind         : if count_only == False and return_distance == False\n",
      " |      (ind, dist) : if count_only == False and return_distance == True\n",
      " |      \n",
      " |      count : array of integers, shape = X.shape[:-1]\n",
      " |          each entry gives the number of neighbors within\n",
      " |          a distance r of the corresponding point.\n",
      " |      \n",
      " |      ind : array of objects, shape = X.shape[:-1]\n",
      " |          each element is a numpy integer array listing the indices of\n",
      " |          neighbors of the corresponding point.  Note that unlike\n",
      " |          the results of a k-neighbors query, the returned neighbors\n",
      " |          are not sorted by distance by default.\n",
      " |      \n",
      " |      dist : array of objects, shape = X.shape[:-1]\n",
      " |          each element is a numpy double array\n",
      " |          listing the distances corresponding to indices in i.\n",
      " |      \n",
      " |      Examples\n",
      " |      --------\n",
      " |      Query for neighbors in a given radius\n",
      " |      \n",
      " |      >>> import numpy as np\n",
      " |      >>> np.random.seed(0)\n",
      " |      >>> X = np.random.random((10, 3))  # 10 points in 3 dimensions\n",
      " |      >>> tree = BinaryTree(X, leaf_size=2)     # doctest: +SKIP\n",
      " |      >>> print tree.query_radius(X[0], r=0.3, count_only=True)\n",
      " |      3\n",
      " |      >>> ind = tree.query_radius(X[0], r=0.3)  # doctest: +SKIP\n",
      " |      >>> print ind  # indices of neighbors within distance 0.3\n",
      " |      [3 0 1]\n",
      " |  \n",
      " |  reset_n_calls(...)\n",
      " |  \n",
      " |  two_point_correlation(...)\n",
      " |      Compute the two-point correlation function\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : array_like\n",
      " |          An array of points to query.  Last dimension should match dimension\n",
      " |          of training data.\n",
      " |      r : array_like\n",
      " |          A one-dimensional array of distances\n",
      " |      dualtree : boolean (default = False)\n",
      " |          If true, use a dualtree algorithm.  Otherwise, use a single-tree\n",
      " |          algorithm.  Dual tree algorithms can have better scaling for\n",
      " |          large N.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      counts : ndarray\n",
      " |          counts[i] contains the number of pairs of points with distance\n",
      " |          less than or equal to r[i]\n",
      " |      \n",
      " |      Examples\n",
      " |      --------\n",
      " |      Compute the two-point autocorrelation function of X:\n",
      " |      \n",
      " |      >>> import numpy as np\n",
      " |      >>> np.random.seed(0)\n",
      " |      >>> X = np.random.random((30, 3))\n",
      " |      >>> r = np.linspace(0, 1, 5)\n",
      " |      >>> tree = BinaryTree(X)     # doctest: +SKIP\n",
      " |      >>> tree.two_point_correlation(X, r)\n",
      " |      array([ 30,  62, 278, 580, 820])\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from BinaryTree:\n",
      " |  \n",
      " |  data\n",
      " |  \n",
      " |  idx_array\n",
      " |  \n",
      " |  node_bounds\n",
      " |  \n",
      " |  node_data\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from BinaryTree:\n",
      " |  \n",
      " |  valid_metrics = ['braycurtis', 'russellrao', 'wminkowski', 'matching',...\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(sklearn.neighbors.BallTree)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "bt = sklearn.neighbors.BallTree(zz[['id', 'stationName', 'latitude', 'longitude']].ix[:, 2:].values, metric='euclidean')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[(72, array([0])),\n",
       " (72, array([0])),\n",
       " (79, array([1])),\n",
       " (79, array([1])),\n",
       " (82, array([2])),\n",
       " (82, array([2])),\n",
       " (83, array([3])),\n",
       " (83, array([3])),\n",
       " (116, array([4])),\n",
       " (116, array([4])),\n",
       " (119, array([5])),\n",
       " (119, array([5])),\n",
       " (120, array([6])),\n",
       " (120, array([6])),\n",
       " (127, array([7])),\n",
       " (127, array([7])),\n",
       " (128, array([8])),\n",
       " (128, array([8])),\n",
       " (137, array([9])),\n",
       " (137, array([9])),\n",
       " (143, array([10])),\n",
       " (143, array([10])),\n",
       " (144, array([11])),\n",
       " (144, array([11])),\n",
       " (146, array([12])),\n",
       " (146, array([12])),\n",
       " (147, array([13])),\n",
       " (147, array([13])),\n",
       " (150, array([14])),\n",
       " (150, array([14])),\n",
       " (151, array([15])),\n",
       " (151, array([15])),\n",
       " (152, array([16])),\n",
       " (152, array([16])),\n",
       " (153, array([17])),\n",
       " (153, array([17])),\n",
       " (157, array([18])),\n",
       " (157, array([18])),\n",
       " (160, array([], dtype=int64)),\n",
       " (160, array([], dtype=int64)),\n",
       " (161, array([19])),\n",
       " (161, array([19])),\n",
       " (164, array([20])),\n",
       " (164, array([20])),\n",
       " (167, array([21])),\n",
       " (167, array([21])),\n",
       " (168, array([22])),\n",
       " (168, array([22])),\n",
       " (173, array([23])),\n",
       " (173, array([23])),\n",
       " (174, array([24])),\n",
       " (174, array([24])),\n",
       " (195, array([25])),\n",
       " (195, array([25])),\n",
       " (212, array([26])),\n",
       " (212, array([26])),\n",
       " (216, array([27])),\n",
       " (216, array([27])),\n",
       " (217, array([28])),\n",
       " (217, array([28])),\n",
       " (218, array([], dtype=int64)),\n",
       " (218, array([], dtype=int64)),\n",
       " (223, array([29])),\n",
       " (223, array([29])),\n",
       " (224, array([30])),\n",
       " (224, array([30])),\n",
       " (225, array([31])),\n",
       " (225, array([31])),\n",
       " (228, array([32])),\n",
       " (228, array([32])),\n",
       " (229, array([33])),\n",
       " (229, array([33])),\n",
       " (232, array([34])),\n",
       " (232, array([34])),\n",
       " (233, array([651])),\n",
       " (233, array([], dtype=int64)),\n",
       " (233, array([651])),\n",
       " (233, array([], dtype=int64)),\n",
       " (236, array([35])),\n",
       " (236, array([35])),\n",
       " (237, array([36])),\n",
       " (237, array([36])),\n",
       " (238, array([37])),\n",
       " (238, array([37])),\n",
       " (239, array([38])),\n",
       " (239, array([38])),\n",
       " (241, array([39])),\n",
       " (241, array([39])),\n",
       " (242, array([40])),\n",
       " (242, array([40])),\n",
       " (242, array([40])),\n",
       " (242, array([40])),\n",
       " (243, array([41])),\n",
       " (243, array([41])),\n",
       " (244, array([42])),\n",
       " (244, array([42])),\n",
       " (245, array([43])),\n",
       " (245, array([43])),\n",
       " (247, array([44])),\n",
       " (247, array([44])),\n",
       " (248, array([45])),\n",
       " (248, array([45])),\n",
       " (249, array([46])),\n",
       " (249, array([46])),\n",
       " (250, array([642])),\n",
       " (250, array([642])),\n",
       " (250, array([642])),\n",
       " (250, array([642])),\n",
       " (251, array([47])),\n",
       " (251, array([47])),\n",
       " (252, array([48])),\n",
       " (252, array([48])),\n",
       " (253, array([49])),\n",
       " (253, array([49])),\n",
       " (254, array([50])),\n",
       " (254, array([50])),\n",
       " (255, array([], dtype=int64)),\n",
       " (255, array([], dtype=int64)),\n",
       " (257, array([51])),\n",
       " (257, array([51])),\n",
       " (258, array([52])),\n",
       " (258, array([52])),\n",
       " (259, array([53])),\n",
       " (259, array([53])),\n",
       " (260, array([54])),\n",
       " (260, array([54])),\n",
       " (261, array([55])),\n",
       " (261, array([55])),\n",
       " (262, array([56])),\n",
       " (262, array([56])),\n",
       " (263, array([], dtype=int64)),\n",
       " (263, array([], dtype=int64)),\n",
       " (264, array([57])),\n",
       " (264, array([57])),\n",
       " (265, array([58])),\n",
       " (265, array([58])),\n",
       " (266, array([59])),\n",
       " (266, array([59])),\n",
       " (267, array([60])),\n",
       " (267, array([60])),\n",
       " (268, array([61])),\n",
       " (268, array([61])),\n",
       " (270, array([62])),\n",
       " (270, array([62])),\n",
       " (271, array([644])),\n",
       " (271, array([644])),\n",
       " (274, array([63])),\n",
       " (274, array([63])),\n",
       " (275, array([64])),\n",
       " (275, array([64])),\n",
       " (276, array([65])),\n",
       " (276, array([65])),\n",
       " (278, array([66])),\n",
       " (278, array([66])),\n",
       " (279, array([], dtype=int64)),\n",
       " (279, array([67])),\n",
       " (279, array([67])),\n",
       " (279, array([67])),\n",
       " (279, array([67])),\n",
       " (279, array([], dtype=int64)),\n",
       " (280, array([68])),\n",
       " (280, array([68])),\n",
       " (281, array([69])),\n",
       " (281, array([69])),\n",
       " (282, array([70])),\n",
       " (282, array([70])),\n",
       " (284, array([71])),\n",
       " (284, array([71])),\n",
       " (285, array([72])),\n",
       " (285, array([72])),\n",
       " (289, array([73])),\n",
       " (289, array([73])),\n",
       " (290, array([], dtype=int64)),\n",
       " (290, array([], dtype=int64)),\n",
       " (291, array([74])),\n",
       " (291, array([74])),\n",
       " (293, array([75])),\n",
       " (293, array([75])),\n",
       " (294, array([], dtype=int64)),\n",
       " (294, array([], dtype=int64)),\n",
       " (295, array([76])),\n",
       " (295, array([76])),\n",
       " (296, array([77])),\n",
       " (296, array([77])),\n",
       " (297, array([78])),\n",
       " (297, array([78])),\n",
       " (298, array([], dtype=int64)),\n",
       " (298, array([], dtype=int64)),\n",
       " (300, array([], dtype=int64)),\n",
       " (300, array([], dtype=int64)),\n",
       " (300, array([], dtype=int64)),\n",
       " (300, array([], dtype=int64)),\n",
       " (301, array([79])),\n",
       " (301, array([79])),\n",
       " (302, array([80])),\n",
       " (302, array([80])),\n",
       " (303, array([81])),\n",
       " (303, array([81])),\n",
       " (304, array([82])),\n",
       " (304, array([82])),\n",
       " (305, array([83])),\n",
       " (305, array([83])),\n",
       " (306, array([84])),\n",
       " (306, array([84])),\n",
       " (307, array([85])),\n",
       " (307, array([85])),\n",
       " (308, array([86])),\n",
       " (308, array([86])),\n",
       " (309, array([87])),\n",
       " (309, array([87])),\n",
       " (310, array([88])),\n",
       " (310, array([88])),\n",
       " (311, array([89])),\n",
       " (311, array([89])),\n",
       " (312, array([90])),\n",
       " (312, array([90])),\n",
       " (312, array([90])),\n",
       " (312, array([90])),\n",
       " (313, array([91])),\n",
       " (313, array([91])),\n",
       " (314, array([92])),\n",
       " (314, array([92])),\n",
       " (314, array([], dtype=int64)),\n",
       " (314, array([], dtype=int64)),\n",
       " (315, array([93])),\n",
       " (315, array([93])),\n",
       " (316, array([94])),\n",
       " (316, array([94])),\n",
       " (317, array([95])),\n",
       " (317, array([95])),\n",
       " (318, array([], dtype=int64)),\n",
       " (318, array([], dtype=int64)),\n",
       " (319, array([96])),\n",
       " (319, array([], dtype=int64)),\n",
       " (319, array([], dtype=int64)),\n",
       " (319, array([96])),\n",
       " (320, array([97])),\n",
       " (320, array([97])),\n",
       " (320, array([97])),\n",
       " (320, array([97])),\n",
       " (321, array([98])),\n",
       " (321, array([98])),\n",
       " (322, array([99])),\n",
       " (322, array([99])),\n",
       " (323, array([100])),\n",
       " (323, array([100])),\n",
       " (324, array([101])),\n",
       " (324, array([101])),\n",
       " (325, array([102])),\n",
       " (325, array([102])),\n",
       " (326, array([103])),\n",
       " (326, array([103])),\n",
       " (327, array([104])),\n",
       " (327, array([104])),\n",
       " (328, array([105])),\n",
       " (328, array([105])),\n",
       " (329, array([], dtype=int64)),\n",
       " (329, array([], dtype=int64)),\n",
       " (329, array([], dtype=int64)),\n",
       " (329, array([], dtype=int64)),\n",
       " (330, array([106])),\n",
       " (330, array([106])),\n",
       " (331, array([107])),\n",
       " (331, array([107])),\n",
       " (332, array([108])),\n",
       " (332, array([108])),\n",
       " (334, array([109])),\n",
       " (334, array([109])),\n",
       " (335, array([110])),\n",
       " (335, array([110])),\n",
       " (336, array([111])),\n",
       " (336, array([111])),\n",
       " (337, array([112])),\n",
       " (337, array([112])),\n",
       " (339, array([113])),\n",
       " (339, array([113])),\n",
       " (340, array([114])),\n",
       " (340, array([114])),\n",
       " (341, array([115])),\n",
       " (341, array([115])),\n",
       " (342, array([116])),\n",
       " (342, array([116])),\n",
       " (343, array([117])),\n",
       " (343, array([117])),\n",
       " (344, array([118])),\n",
       " (344, array([118])),\n",
       " (345, array([119])),\n",
       " (345, array([119])),\n",
       " (346, array([120])),\n",
       " (346, array([120])),\n",
       " (347, array([], dtype=int64)),\n",
       " (347, array([121])),\n",
       " (347, array([121])),\n",
       " (347, array([], dtype=int64)),\n",
       " (348, array([122])),\n",
       " (348, array([122])),\n",
       " (349, array([123])),\n",
       " (349, array([123])),\n",
       " (350, array([124])),\n",
       " (350, array([124])),\n",
       " (351, array([125])),\n",
       " (351, array([125])),\n",
       " (352, array([126])),\n",
       " (352, array([126])),\n",
       " (353, array([127])),\n",
       " (353, array([127])),\n",
       " (354, array([128])),\n",
       " (354, array([128])),\n",
       " (355, array([129])),\n",
       " (355, array([129])),\n",
       " (356, array([130])),\n",
       " (356, array([130])),\n",
       " (357, array([131])),\n",
       " (357, array([131])),\n",
       " (358, array([132])),\n",
       " (358, array([132])),\n",
       " (359, array([133])),\n",
       " (359, array([133])),\n",
       " (360, array([134])),\n",
       " (360, array([134])),\n",
       " (361, array([135])),\n",
       " (361, array([135])),\n",
       " (362, array([136])),\n",
       " (362, array([136])),\n",
       " (363, array([137])),\n",
       " (363, array([137])),\n",
       " (364, array([138])),\n",
       " (364, array([138])),\n",
       " (365, array([139])),\n",
       " (365, array([139])),\n",
       " (366, array([140])),\n",
       " (366, array([140])),\n",
       " (367, array([], dtype=int64)),\n",
       " (367, array([], dtype=int64)),\n",
       " (368, array([141])),\n",
       " (368, array([141])),\n",
       " (369, array([142])),\n",
       " (369, array([142])),\n",
       " (372, array([143])),\n",
       " (372, array([143])),\n",
       " (373, array([144])),\n",
       " (373, array([144])),\n",
       " (375, array([487])),\n",
       " (375, array([487])),\n",
       " (375, array([487])),\n",
       " (375, array([487])),\n",
       " (376, array([145])),\n",
       " (376, array([145])),\n",
       " (377, array([146])),\n",
       " (377, array([146])),\n",
       " (379, array([147])),\n",
       " (379, array([147])),\n",
       " (380, array([148])),\n",
       " (380, array([148])),\n",
       " (382, array([149])),\n",
       " (382, array([149])),\n",
       " (383, array([150])),\n",
       " (383, array([150])),\n",
       " (384, array([151])),\n",
       " (384, array([151])),\n",
       " (384, array([], dtype=int64)),\n",
       " (384, array([], dtype=int64)),\n",
       " (385, array([152])),\n",
       " (385, array([152])),\n",
       " (386, array([153])),\n",
       " (386, array([153])),\n",
       " (387, array([154])),\n",
       " (387, array([154])),\n",
       " (388, array([155])),\n",
       " (388, array([155])),\n",
       " (389, array([156])),\n",
       " (389, array([156])),\n",
       " (390, array([157])),\n",
       " (390, array([157])),\n",
       " (391, array([158])),\n",
       " (391, array([158])),\n",
       " (392, array([159])),\n",
       " (392, array([159])),\n",
       " (393, array([160])),\n",
       " (393, array([160])),\n",
       " (394, array([161])),\n",
       " (394, array([161])),\n",
       " (395, array([162])),\n",
       " (395, array([162])),\n",
       " (396, array([163])),\n",
       " (396, array([163])),\n",
       " (397, array([164])),\n",
       " (397, array([164])),\n",
       " (398, array([165])),\n",
       " (398, array([165])),\n",
       " (399, array([166])),\n",
       " (399, array([166])),\n",
       " (400, array([167])),\n",
       " (400, array([167])),\n",
       " (401, array([168])),\n",
       " (401, array([168])),\n",
       " (402, array([169])),\n",
       " (402, array([169])),\n",
       " (403, array([170])),\n",
       " (403, array([170])),\n",
       " (404, array([], dtype=int64)),\n",
       " (404, array([], dtype=int64)),\n",
       " (405, array([171])),\n",
       " (405, array([171])),\n",
       " (406, array([172])),\n",
       " (406, array([172])),\n",
       " (407, array([173])),\n",
       " (407, array([173])),\n",
       " (408, array([174])),\n",
       " (408, array([174])),\n",
       " (409, array([175])),\n",
       " (409, array([175])),\n",
       " (410, array([176])),\n",
       " (410, array([176])),\n",
       " (411, array([177])),\n",
       " (411, array([177])),\n",
       " (412, array([178])),\n",
       " (412, array([178])),\n",
       " (414, array([179])),\n",
       " (414, array([179])),\n",
       " (415, array([180])),\n",
       " (415, array([180])),\n",
       " (416, array([181])),\n",
       " (416, array([181])),\n",
       " (417, array([182])),\n",
       " (417, array([182])),\n",
       " (418, array([183])),\n",
       " (418, array([183])),\n",
       " (419, array([184])),\n",
       " (419, array([184])),\n",
       " (420, array([185])),\n",
       " (420, array([185])),\n",
       " (421, array([186])),\n",
       " (421, array([186])),\n",
       " (422, array([187])),\n",
       " (422, array([187])),\n",
       " (423, array([188])),\n",
       " (423, array([188])),\n",
       " (426, array([189])),\n",
       " (426, array([189])),\n",
       " (427, array([190])),\n",
       " (427, array([], dtype=int64)),\n",
       " (427, array([190])),\n",
       " (427, array([], dtype=int64)),\n",
       " (428, array([191])),\n",
       " (428, array([191])),\n",
       " (430, array([192])),\n",
       " (430, array([192])),\n",
       " (431, array([], dtype=int64)),\n",
       " (431, array([], dtype=int64)),\n",
       " (432, array([193])),\n",
       " (432, array([193])),\n",
       " (433, array([194])),\n",
       " (433, array([194])),\n",
       " (434, array([195])),\n",
       " (434, array([195])),\n",
       " (435, array([196])),\n",
       " (435, array([196])),\n",
       " (436, array([197])),\n",
       " (436, array([197])),\n",
       " (437, array([198])),\n",
       " (437, array([198])),\n",
       " (438, array([199])),\n",
       " (438, array([199])),\n",
       " (439, array([200])),\n",
       " (439, array([200])),\n",
       " (440, array([201])),\n",
       " (440, array([201])),\n",
       " (441, array([202])),\n",
       " (441, array([202])),\n",
       " (442, array([203])),\n",
       " (442, array([203])),\n",
       " (443, array([204])),\n",
       " (443, array([204])),\n",
       " (443, array([204])),\n",
       " (443, array([204])),\n",
       " (444, array([205])),\n",
       " (444, array([205])),\n",
       " (445, array([206])),\n",
       " (445, array([206])),\n",
       " (446, array([207])),\n",
       " (446, array([207])),\n",
       " (447, array([208])),\n",
       " (447, array([208])),\n",
       " (448, array([209])),\n",
       " (448, array([209])),\n",
       " (449, array([210])),\n",
       " (449, array([210])),\n",
       " (450, array([211])),\n",
       " (450, array([211])),\n",
       " (453, array([212])),\n",
       " (453, array([212])),\n",
       " (454, array([213])),\n",
       " (454, array([213])),\n",
       " (455, array([214])),\n",
       " (455, array([214])),\n",
       " (456, array([215])),\n",
       " (456, array([215])),\n",
       " (457, array([216])),\n",
       " (457, array([216])),\n",
       " (458, array([217])),\n",
       " (458, array([217])),\n",
       " (459, array([218])),\n",
       " (459, array([218])),\n",
       " (460, array([219])),\n",
       " (460, array([219])),\n",
       " (461, array([220])),\n",
       " (461, array([220])),\n",
       " (462, array([221])),\n",
       " (462, array([221])),\n",
       " (463, array([], dtype=int64)),\n",
       " (463, array([], dtype=int64)),\n",
       " (464, array([], dtype=int64)),\n",
       " (464, array([], dtype=int64)),\n",
       " (465, array([222])),\n",
       " (465, array([222])),\n",
       " (466, array([223])),\n",
       " (466, array([223])),\n",
       " (467, array([224])),\n",
       " (467, array([224])),\n",
       " (468, array([225])),\n",
       " (468, array([225])),\n",
       " (469, array([226])),\n",
       " (469, array([226])),\n",
       " (470, array([227])),\n",
       " (470, array([227])),\n",
       " (471, array([228])),\n",
       " (471, array([228])),\n",
       " (472, array([229])),\n",
       " (472, array([229])),\n",
       " (473, array([230])),\n",
       " (473, array([230])),\n",
       " (474, array([231])),\n",
       " (474, array([231])),\n",
       " (475, array([663])),\n",
       " (475, array([663])),\n",
       " (476, array([232])),\n",
       " (476, array([232])),\n",
       " (477, array([233])),\n",
       " (477, array([233])),\n",
       " (478, array([234])),\n",
       " (478, array([234])),\n",
       " (479, array([235])),\n",
       " (479, array([235])),\n",
       " (480, array([236])),\n",
       " (480, array([236])),\n",
       " (481, array([237])),\n",
       " (481, array([237])),\n",
       " (482, array([238])),\n",
       " (482, array([238])),\n",
       " (483, array([239])),\n",
       " (483, array([239])),\n",
       " (484, array([240])),\n",
       " (484, array([240])),\n",
       " (485, array([241])),\n",
       " (485, array([241])),\n",
       " (486, array([242])),\n",
       " (486, array([242])),\n",
       " (487, array([243])),\n",
       " (487, array([243])),\n",
       " (488, array([244])),\n",
       " (488, array([244])),\n",
       " (489, array([], dtype=int64)),\n",
       " (489, array([], dtype=int64)),\n",
       " (490, array([245])),\n",
       " (490, array([245])),\n",
       " (491, array([246])),\n",
       " (491, array([246])),\n",
       " (492, array([247])),\n",
       " (492, array([247])),\n",
       " (493, array([248])),\n",
       " (493, array([248])),\n",
       " (494, array([249])),\n",
       " (494, array([249])),\n",
       " (495, array([250])),\n",
       " (495, array([250])),\n",
       " (496, array([251])),\n",
       " (496, array([251])),\n",
       " (497, array([252])),\n",
       " (497, array([252])),\n",
       " (498, array([253])),\n",
       " (498, array([253])),\n",
       " (499, array([254])),\n",
       " (499, array([254])),\n",
       " (500, array([255])),\n",
       " (500, array([255])),\n",
       " (501, array([256])),\n",
       " (501, array([256])),\n",
       " (502, array([257])),\n",
       " (502, array([257])),\n",
       " (503, array([258])),\n",
       " (503, array([258])),\n",
       " (504, array([259])),\n",
       " (504, array([259])),\n",
       " (504, array([259])),\n",
       " (504, array([259])),\n",
       " (505, array([260])),\n",
       " (505, array([260])),\n",
       " (507, array([261])),\n",
       " (507, array([261])),\n",
       " (508, array([262])),\n",
       " (508, array([262])),\n",
       " (509, array([263])),\n",
       " (509, array([263])),\n",
       " (510, array([], dtype=int64)),\n",
       " (510, array([], dtype=int64)),\n",
       " (511, array([264])),\n",
       " (511, array([264])),\n",
       " (512, array([], dtype=int64)),\n",
       " (512, array([], dtype=int64)),\n",
       " (513, array([265])),\n",
       " (513, array([265])),\n",
       " (514, array([266])),\n",
       " (514, array([266])),\n",
       " (515, array([267])),\n",
       " (515, array([267])),\n",
       " (516, array([268])),\n",
       " (516, array([268])),\n",
       " (517, array([271, 269])),\n",
       " (517, array([475])),\n",
       " (517, array([271, 269])),\n",
       " (517, array([271, 269])),\n",
       " (517, array([475])),\n",
       " (517, array([271, 269])),\n",
       " (518, array([270])),\n",
       " (518, array([270])),\n",
       " (519, array([271, 269])),\n",
       " (519, array([271, 269])),\n",
       " (519, array([271, 269])),\n",
       " (519, array([], dtype=int64)),\n",
       " (519, array([], dtype=int64)),\n",
       " (519, array([271, 269])),\n",
       " (520, array([272])),\n",
       " (520, array([272])),\n",
       " (521, array([483])),\n",
       " (521, array([483])),\n",
       " (521, array([483])),\n",
       " (521, array([483])),\n",
       " (522, array([273])),\n",
       " (522, array([273])),\n",
       " (523, array([274])),\n",
       " (523, array([274])),\n",
       " (524, array([275])),\n",
       " (524, array([275])),\n",
       " (525, array([276])),\n",
       " (525, array([276])),\n",
       " (526, array([277])),\n",
       " (526, array([277])),\n",
       " (527, array([], dtype=int64)),\n",
       " (527, array([278])),\n",
       " (527, array([278])),\n",
       " (527, array([], dtype=int64)),\n",
       " (528, array([279])),\n",
       " (528, array([279])),\n",
       " (529, array([280])),\n",
       " (529, array([280])),\n",
       " (530, array([281])),\n",
       " (530, array([281])),\n",
       " (531, array([282])),\n",
       " (531, array([282])),\n",
       " (532, array([283])),\n",
       " (532, array([283])),\n",
       " (533, array([284])),\n",
       " (533, array([284])),\n",
       " (534, array([285])),\n",
       " (534, array([285])),\n",
       " (536, array([286])),\n",
       " (536, array([286])),\n",
       " (537, array([287])),\n",
       " (537, array([287])),\n",
       " (538, array([], dtype=int64)),\n",
       " (538, array([], dtype=int64)),\n",
       " (538, array([], dtype=int64)),\n",
       " (538, array([], dtype=int64)),\n",
       " (539, array([288])),\n",
       " (539, array([288])),\n",
       " (540, array([], dtype=int64)),\n",
       " (540, array([289])),\n",
       " (540, array([], dtype=int64)),\n",
       " (540, array([289])),\n",
       " (545, array([290])),\n",
       " (545, array([290])),\n",
       " (546, array([291])),\n",
       " (546, array([291])),\n",
       " (2000, array([292])),\n",
       " (2000, array([292])),\n",
       " (2001, array([], dtype=int64)),\n",
       " (2001, array([293])),\n",
       " (2001, array([293])),\n",
       " (2001, array([], dtype=int64)),\n",
       " (2002, array([294])),\n",
       " (2002, array([294])),\n",
       " (2003, array([295])),\n",
       " (2003, array([295])),\n",
       " (2004, array([296])),\n",
       " (2004, array([296])),\n",
       " (2005, array([297])),\n",
       " (2005, array([297])),\n",
       " (2006, array([298])),\n",
       " (2006, array([298])),\n",
       " (2008, array([299])),\n",
       " (2008, array([299])),\n",
       " (2009, array([300])),\n",
       " (2009, array([300])),\n",
       " (2010, array([301])),\n",
       " (2010, array([301])),\n",
       " (2012, array([302])),\n",
       " (2012, array([302])),\n",
       " (2017, array([], dtype=int64)),\n",
       " (2017, array([], dtype=int64)),\n",
       " (2021, array([303])),\n",
       " (2021, array([303])),\n",
       " (2022, array([], dtype=int64)),\n",
       " (2022, array([], dtype=int64)),\n",
       " (2022, array([304])),\n",
       " (2022, array([304])),\n",
       " (2023, array([305])),\n",
       " (2023, array([305])),\n",
       " (3002, array([306])),\n",
       " (3002, array([306])),\n",
       " (3014, array([], dtype=int64)),\n",
       " (3014, array([], dtype=int64)),\n",
       " (3014, array([], dtype=int64)),\n",
       " (3014, array([], dtype=int64)),\n",
       " (3016, array([395])),\n",
       " (3016, array([307])),\n",
       " (3016, array([307])),\n",
       " (3016, array([395])),\n",
       " (3017, array([], dtype=int64)),\n",
       " (3017, array([], dtype=int64)),\n",
       " (3019, array([], dtype=int64)),\n",
       " (3036, array([], dtype=int64)),\n",
       " (3039, array([476])),\n",
       " (3040, array([], dtype=int64)),\n",
       " (3040, array([], dtype=int64)),\n",
       " (3041, array([308])),\n",
       " (3041, array([308])),\n",
       " (3042, array([309])),\n",
       " (3042, array([309])),\n",
       " (3043, array([310])),\n",
       " (3043, array([310])),\n",
       " (3044, array([311])),\n",
       " (3044, array([311])),\n",
       " (3046, array([312])),\n",
       " (3046, array([312])),\n",
       " (3047, array([313])),\n",
       " (3047, array([313])),\n",
       " (3048, array([314])),\n",
       " (3048, array([314])),\n",
       " (3049, array([315])),\n",
       " (3049, array([315])),\n",
       " (3050, array([316])),\n",
       " (3050, array([316])),\n",
       " (3052, array([317])),\n",
       " (3052, array([317])),\n",
       " (3053, array([318])),\n",
       " (3053, array([318])),\n",
       " (3054, array([319])),\n",
       " (3054, array([319])),\n",
       " (3055, array([320])),\n",
       " (3055, array([320])),\n",
       " (3056, array([321])),\n",
       " (3056, array([321])),\n",
       " (3057, array([322])),\n",
       " (3057, array([322])),\n",
       " (3058, array([323])),\n",
       " (3058, array([323])),\n",
       " (3059, array([324])),\n",
       " (3059, array([324])),\n",
       " (3060, array([325])),\n",
       " (3060, array([325])),\n",
       " (3061, array([326])),\n",
       " (3061, array([326])),\n",
       " (3062, array([327])),\n",
       " (3062, array([327])),\n",
       " (3063, array([328])),\n",
       " (3063, array([328])),\n",
       " (3064, array([329])),\n",
       " (3064, array([329])),\n",
       " (3065, array([330])),\n",
       " (3065, array([330])),\n",
       " (3066, array([331])),\n",
       " (3066, array([331])),\n",
       " (3067, array([332])),\n",
       " (3067, array([332])),\n",
       " (3068, array([333])),\n",
       " (3068, array([333])),\n",
       " (3069, array([334])),\n",
       " (3069, array([334])),\n",
       " (3070, array([335])),\n",
       " (3070, array([335])),\n",
       " (3071, array([336])),\n",
       " (3071, array([336])),\n",
       " (3072, array([337])),\n",
       " (3072, array([337])),\n",
       " (3073, array([338])),\n",
       " (3073, array([338])),\n",
       " (3074, array([339])),\n",
       " (3074, array([339])),\n",
       " (3075, array([340])),\n",
       " (3075, array([340])),\n",
       " (3076, array([341])),\n",
       " (3076, array([341])),\n",
       " (3077, array([342])),\n",
       " (3077, array([342])),\n",
       " (3078, array([343])),\n",
       " (3078, array([343])),\n",
       " (3079, array([], dtype=int64)),\n",
       " (3079, array([], dtype=int64)),\n",
       " (3080, array([344])),\n",
       " (3080, array([344])),\n",
       " (3081, array([345])),\n",
       " (3081, array([345])),\n",
       " (3082, array([346])),\n",
       " (3082, array([346])),\n",
       " (3083, array([347])),\n",
       " (3083, array([347])),\n",
       " (3084, array([], dtype=int64)),\n",
       " (3084, array([], dtype=int64)),\n",
       " (3085, array([348])),\n",
       " (3085, array([348])),\n",
       " (3086, array([349])),\n",
       " (3086, array([349])),\n",
       " (3087, array([350])),\n",
       " (3087, array([350])),\n",
       " (3088, array([351])),\n",
       " (3088, array([351])),\n",
       " (3089, array([], dtype=int64)),\n",
       " (3089, array([], dtype=int64)),\n",
       " (3090, array([352])),\n",
       " (3090, array([352])),\n",
       " (3091, array([353])),\n",
       " (3091, array([353])),\n",
       " (3092, array([354])),\n",
       " (3092, array([354])),\n",
       " (3093, array([355])),\n",
       " (3093, array([355])),\n",
       " (3094, array([356])),\n",
       " (3094, array([356])),\n",
       " (3095, array([357])),\n",
       " (3095, array([357])),\n",
       " (3096, array([358])),\n",
       " (3096, array([358])),\n",
       " (3097, array([645])),\n",
       " (3097, array([645])),\n",
       " (3098, array([656])),\n",
       " (3098, array([656])),\n",
       " (3099, array([], dtype=int64)),\n",
       " (3099, array([], dtype=int64)),\n",
       " (3100, array([359])),\n",
       " (3100, array([359])),\n",
       " (3101, array([360])),\n",
       " (3101, array([360])),\n",
       " (3102, array([361])),\n",
       " (3102, array([361])),\n",
       " (3103, array([362])),\n",
       " (3103, array([362])),\n",
       " (3104, array([307])),\n",
       " (3104, array([307])),\n",
       " (3104, array([307])),\n",
       " (3104, array([307])),\n",
       " (3105, array([363])),\n",
       " (3105, array([363])),\n",
       " (3106, array([364])),\n",
       " (3106, array([364])),\n",
       " (3107, array([365])),\n",
       " (3107, array([365])),\n",
       " (3108, array([366])),\n",
       " (3108, array([366])),\n",
       " (3109, array([367])),\n",
       " (3109, array([367])),\n",
       " (3110, array([368])),\n",
       " (3110, array([368])),\n",
       " (3111, array([369])),\n",
       " (3111, array([369])),\n",
       " (3112, array([370])),\n",
       " (3112, array([370])),\n",
       " (3113, array([371])),\n",
       " (3113, array([371])),\n",
       " (3114, array([372])),\n",
       " (3114, array([372])),\n",
       " (3115, array([373])),\n",
       " (3115, array([373])),\n",
       " (3116, array([374])),\n",
       " (3116, array([374])),\n",
       " (3117, array([375])),\n",
       " (3117, array([375])),\n",
       " (3118, array([376])),\n",
       " (3118, array([376])),\n",
       " (3119, array([377])),\n",
       " (3119, array([377])),\n",
       " (3120, array([378])),\n",
       " (3120, array([378])),\n",
       " (3120, array([378])),\n",
       " (3120, array([378])),\n",
       " (3121, array([379])),\n",
       " (3121, array([379])),\n",
       " (3122, array([380])),\n",
       " (3122, array([380])),\n",
       " (3123, array([381])),\n",
       " (3123, array([381])),\n",
       " (3124, array([382])),\n",
       " (3124, array([382])),\n",
       " (3125, array([383])),\n",
       " (3125, array([383])),\n",
       " (3126, array([384])),\n",
       " (3126, array([384])),\n",
       " (3127, array([385])),\n",
       " (3127, array([385])),\n",
       " (3128, array([386])),\n",
       " (3128, array([386])),\n",
       " (3129, array([387])),\n",
       " (3129, array([387])),\n",
       " (3130, array([388])),\n",
       " (3130, array([388])),\n",
       " (3131, array([389])),\n",
       " (3131, array([389])),\n",
       " (3132, array([390])),\n",
       " (3132, array([390])),\n",
       " (3133, array([], dtype=int64)),\n",
       " (3133, array([], dtype=int64)),\n",
       " (3133, array([], dtype=int64)),\n",
       " (3133, array([], dtype=int64)),\n",
       " (3134, array([391])),\n",
       " (3134, array([391])),\n",
       " (3135, array([392])),\n",
       " (3135, array([392])),\n",
       " (3136, array([393])),\n",
       " (3136, array([393])),\n",
       " (3137, array([394])),\n",
       " (3137, array([394])),\n",
       " (3138, array([], dtype=int64)),\n",
       " (3138, array([], dtype=int64)),\n",
       " (3139, array([395])),\n",
       " (3139, array([395])),\n",
       " (3140, array([396])),\n",
       " (3140, array([396])),\n",
       " (3141, array([397])),\n",
       " (3141, array([397])),\n",
       " (3142, array([398])),\n",
       " (3142, array([398])),\n",
       " (3143, array([399])),\n",
       " (3143, array([399])),\n",
       " (3144, array([400])),\n",
       " (3144, array([400])),\n",
       " (3145, array([401])),\n",
       " (3145, array([401])),\n",
       " (3146, array([402])),\n",
       " (3146, array([402])),\n",
       " (3147, array([403])),\n",
       " (3147, array([403])),\n",
       " (3148, array([404])),\n",
       " (3148, array([404])),\n",
       " (3149, array([], dtype=int64)),\n",
       " (3149, array([], dtype=int64)),\n",
       " (3150, array([405])),\n",
       " (3150, array([405])),\n",
       " (3151, array([406])),\n",
       " (3151, array([406])),\n",
       " (3152, array([407])),\n",
       " (3152, array([407])),\n",
       " (3153, array([], dtype=int64)),\n",
       " (3153, array([], dtype=int64)),\n",
       " (3154, array([], dtype=int64)),\n",
       " (3154, array([], dtype=int64)),\n",
       " (3155, array([408])),\n",
       " (3155, array([408])),\n",
       " (3156, array([409])),\n",
       " (3156, array([409])),\n",
       " (3157, array([410])),\n",
       " (3157, array([410])),\n",
       " (3158, array([411])),\n",
       " (3158, array([411])),\n",
       " (3159, array([412])),\n",
       " (3159, array([412])),\n",
       " (3160, array([413])),\n",
       " (3160, array([413])),\n",
       " (3161, array([414])),\n",
       " (3161, array([414])),\n",
       " (3162, array([415])),\n",
       " (3162, array([415])),\n",
       " (3163, array([416])),\n",
       " (3163, array([416])),\n",
       " (3164, array([417])),\n",
       " (3164, array([417])),\n",
       " (3165, array([418])),\n",
       " (3165, array([418])),\n",
       " (3166, array([419])),\n",
       " (3166, array([419])),\n",
       " (3166, array([419])),\n",
       " (3166, array([419])),\n",
       " (3167, array([420])),\n",
       " (3167, array([420])),\n",
       " (3168, array([421])),\n",
       " (3168, array([421])),\n",
       " (3169, array([422])),\n",
       " (3169, array([422])),\n",
       " (3170, array([423])),\n",
       " (3170, array([423])),\n",
       " (3171, array([424])),\n",
       " ...]"
      ]
     },
     "execution_count": 114,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(zip(c.id, bt.query_radius(c.ix[:,['lat', 'lon']], 0.0005)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0         [0]\n",
       "1         [0]\n",
       "2         [1]\n",
       "3         [1]\n",
       "4         [2]\n",
       "5         [2]\n",
       "6         [3]\n",
       "7         [3]\n",
       "8         [4]\n",
       "9         [4]\n",
       "10        [5]\n",
       "11        [5]\n",
       "12        [6]\n",
       "13        [6]\n",
       "14        [7]\n",
       "15        [7]\n",
       "16        [8]\n",
       "17        [8]\n",
       "18        [9]\n",
       "19        [9]\n",
       "20       [10]\n",
       "21       [10]\n",
       "22       [11]\n",
       "23       [11]\n",
       "24       [12]\n",
       "25       [12]\n",
       "26       [13]\n",
       "27       [13]\n",
       "28       [14]\n",
       "29       [14]\n",
       "        ...  \n",
       "1383    [638]\n",
       "1384    [639]\n",
       "1385    [639]\n",
       "1386    [640]\n",
       "1387    [640]\n",
       "1388    [641]\n",
       "1389    [641]\n",
       "1390    [642]\n",
       "1391    [642]\n",
       "1392    [643]\n",
       "1393    [643]\n",
       "1394    [644]\n",
       "1395    [644]\n",
       "1396    [645]\n",
       "1397    [645]\n",
       "1398    [646]\n",
       "1399    [646]\n",
       "1400       []\n",
       "1401       []\n",
       "1402    [647]\n",
       "1403    [647]\n",
       "1404    [648]\n",
       "1405    [648]\n",
       "1406    [649]\n",
       "1407    [649]\n",
       "1408    [650]\n",
       "1409    [650]\n",
       "1410    [169]\n",
       "1411    [651]\n",
       "1412    [651]\n",
       "dtype: object"
      ]
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.Series(bt.query_radius(c.ix[:,['lat', 'lon']], 0.0005))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
